[wtr-general] EXCEL how to array only one value from a range when A=B
Hello, it's my file Excel : 10 Limousin 11 Lorraine 12 Midi-Pyrénées 13 Nord-Pas de Calais 14 Basse Normandie 15 Haute Normandie 16 Pays de la loire 17 Picardie 18 Poitou-Charentes 19 Provence-Alpes-Côte d'Azur 20 Rhone-Alpes 21 Corse 22 Outre Mer et Etranger and it's my script : require 'watir' require 'win32ole' puts Choisir Region 10=Limousin 11=Lorraine 12=Midi-Pyrenees 13=Nord-Pas de Calais 14=Basse Normandie 15=Haute Normandie 16=Pays de la loire 17=Picardie 18=Poitou-Charentes 19=Provence-Alpes-Cote d'Azur 20=Rhone-Alpes 21=Corse 22=Outre Mer et Etranger ? region=gets # I ask to enter a number between 10 to 22 excel = WIN32OLE::new('excel.Application') excel.DisplayAlerts = false excel.Visible = 1 workbook = excel.Workbooks.Open('C:\Ruby191\rv.xls') for i in 1 .. workbook.Worksheets.Count worksheet = workbook.Worksheets(i) rowcount = worksheet.UsedRange.Rows.Count for j in 1..rowcount num =worksheet.Cells(j, 1).value nu=num.round(0) if nu=region puts worksheet.Cells(j, 2).value end end end with that script it array all worksheet.Cells(j, 2).value, I don't know how to array only worksheet.Cells(j, 2).value where nu=region Do you have an idea? thx -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Need to get/retrieve value
THERE IS NO SUCH GEM. NO. HELL NO. and a Thousand Times I tell you NO. The purpose of a captcha is a challenge to prove that it is a human at the computer, to prevented scripted attacks on the site from spammers and the like. The site cannot tell a scripted interaction from a tester from a scripted interaction from a spammer or other attacker. if the client needs you to test against production then you need to test pages with a captcha manually, or they would need to temporarily disable the captcha for the duration of the test, or set it to use a fixed answer for the duration of the test. You CANNOT script against a working captcha without a human in the loop. That's the design and purpose of a captcha. And if you somehow found a way to do that, then the client needs a better quality captcha, because if you can figure out a way, so will the spammers. NOBODY who isn't a spammer is likely to develop a means to get around captchas because we know it would then be immediately discovered and used BY spammers, and nobody wants to help spammers. Nobody here is going to help YOU do the same thing for the same reason, even if you are not a spammer, one could come along later and read the answer. stop trying to go there. Likewise, there is no way for the site to know your scripted interaction (against a production site) is 'safe' that would not potentially be used or exploited by spammers.. so I strongly discourage anything along those lines as it would just be introducing a chink in the sites defenses that could later be exploited to attack the site. If your client is asking you to write scripting against pages with captchas, point out to them that this is a bit like asking you to move an object they designed to be immovable. On Feb 22, 9:15 am, Aditya vaditya2...@gmail.com wrote: A good idea already thinking the same. But the client needs on production environment too. So do we have any gem atleast once the page is loaded can we get the value after page is displayed? Any idea ? On Tue, Feb 22, 2011 at 7:36 PM, Basim Baassiri ba...@baassiri.ca wrote: I've had a similar problem in automating a signup page that had a captcha on it. I solved it by implementing in the production code to detect the test environment and when the test environment was evaluated the captcha was hardcoded to QAQA and hence i used that string to proceed with the signup page Hopefully that can help you On Tue, Feb 22, 2011 at 5:30 AM, Aditya vaditya2...@gmail.com wrote: Thanks for the valuable information. Can i use rmagick gem in order to validate the captcha? and can i use it in watir? On Tue, Feb 22, 2011 at 3:50 PM, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Tue, Feb 22, 2011 at 11:17 AM, Aditya vaditya2...@gmail.com wrote: How do we handle in terms of automation? Captchas are made explicitly so they could not be automated. If I had to automate site that used Captcha, I would test them manually. Željko -- Before posting, please readhttp://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Before posting, please readhttp://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Before posting, please readhttp://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com- Hide quoted text - - Show quoted text - -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Need to get/read/retrieve the value
You're trying to script against a captcha? LOL. do you understand the phrase 'tilting at windmills'? have fun storming the castle. v On Feb 22, 12:13 am, V vaditya2...@gmail.com wrote: Hi, My Source is : img style=color: Red; height: 60px; width: 165px; border-width: 0px; src=GetImage.aspx?Rand=6162636 id=ctl00_MainContentPlaceHolder_imgCaptcha i need to get the value in the image. How can i proceed/handle this? This is the first requirement as i need to login to the application and proceed to do automation. HELP ME its URGENT -- Regards, V -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Need Help on Span ......Filipin
not without a better example of the source for the page you are trying to automate and exactly what it is you are trying to do On Feb 21, 6:23 am, mike_sukhi sukhija...@gmail.com wrote: ANY BODY CAN HELP PLZ On Feb 20, 9:41 pm, mike_sukhi sukhija...@gmail.com wrote: ok I found a example ..may b that can help you.According to that script looks like this... require 'rubygems' require 'Watir' #Watir::Browser require 'win32ole' Watir::Browser.default = 'firefox' $IE = Watir::Browser.new $IE.goto(http://www.earnlikes.com/fans;) sleep 5 $IE.text_field(:id, 'pageurl').set('www.facebook.com/ aneeskAclickography') ## Image HTML: IMG onclick=facebookLikes(1); alt= src=http://www.earnlikes.com/templates/images/btn_submiturl.gif; sleep 12 $IE.image(:index, 5).click sleep 12 = #$IE.span(:text, Like).click or #levelone_dropdown = 'Like' #$IE.element_by_xpath(//div[2]/table/tbody/tr/td/div/div/a/ span[contains(text(),'#{levelone_dropdown}')]).click I have tried above both but not working.. = On Feb 20, 5:12 pm, Mohit sukhija...@gmail.com wrote: I Have also tried. but still no luck using xpath. This xpath i copied using friebug and seems to be good. levelone_dropdown = 'Hello' $IE.element_by_xpath(//div[2]/table/tbody/tr/td/div/div/a/span[contains(text(),'#{levelone_dropdown}')]).click the full path is as copied using firebug: /html/body/div[2]/table/tbody/tr/td/div/div/a/span hello is inside this span.. I hope this makes you clear hiow to proceed by xpath On Sun, Feb 20, 2011 at 4:17 PM, Mohit sukhija...@gmail.com wrote: the xpath i found for hello is /html/body/div[2]/table/tbody/tr/td/div/div/a/span but not able to click ie.link(:xpath,/html/body/div[2]/table/tbody/tr/td/div/div/a/span/hello).click On Thu, Feb 17, 2011 at 9:20 PM, sdemian sergeydemjanc...@gmail.comwrote: I am really confused by your new code also it is seriously differ from previous one and i could not find span with hello text in it, cuz the main idea was to locate span element on the page as i understand. Still recommend to use xpath for element location, probably HttpWatch is handy to use here. On Feb 17, 5:02 pm, mike_sukhi sukhija...@gmail.com wrote: the code now of a div is in which hello is not showing but it seems to hello-button-11 is the real button and hello is a image..i guess :) div class=time div id=hello-button-11 class=linkbtn fb:hello font=arial width=100 show_faces=false layout=button_count href=http://www.abc.com/ elitegudz class= fb_edge_widget_with_comment fb_iframe_widgetspaniframe scrolling=no id=f545a8562f2a38 name=f2cdf57ef4ea374 style=border: medium none; overflow: hidden; height: 20px; width: 100px; title=Like this content on Facebook. class=fb_ltr src=http://www.abc.com/ plug;layout=button_countamp;locale=en_USamp;node_type=linkamp;sdk=joeyamp;show_faces=falseamp;width=100/ iframe/span/fb:like /div div align=left class=americaairGudzbr b a target=_blank href=http://www.abc.com/; http://www.abc.com//a a target=_blank href=http://www.abc.com/;img src=http://www.time.com/templates/images/ icon.gif/a /b /div !--div class=icon/div-- /div On Feb 17, 6:37 pm, Сергей Демьянчук sergeydemjanc...@gmail.com wrote: Try this code to see available properties for spans on the page : ie.spans.each do |span| span.flash span.to_s end Also this code works for me: ie.span(:text, 'Hello').flash If those spans are in the frame you possibly will need additional code to use. I suggest to use xpath to locate elements with same properties. What effect do you want to achieve clicking on the span ? 2011/2/17 mike_sukhi sukhija...@gmail.com The code is: td class=connect_widget_vertical_center connect_widget_button_celldiv class=connect_button_sliderdiv class=connect_button_containera class=connect_widget_text_button clearfix time_button_no_timespan class=timeHello/span/a/ div/div/td Hello appears 10 times on the page..with same code: I have tried with the following option but no success. $IE.span(:class ='time', :text ='Hello').click or $IE.span(:class ='time', :index=7).click still no sucess ... -- Before posting, please readhttp://watir.com/support. In short: search before you ask, be nice.
Re: [wtr-general] EXCEL how to array only one value from a range when A=B
On Wed, Feb 23, 2011 at 4:52 AM, keneda 45 widiz...@gmail.com wrote: require 'watir' All I know is that you do not need to require watir, because it has nothing to do with Excel files. :) You should ask this also at a Ruby forum and/or Stack Overflow. Željko -- watir.com - community manager watirpodcast.com - host testingpodcast.com - audio podcasts on software testing. all of them -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Ruby 1.9.2: unknown method: 'maxlength' for textarea, fine with Ruby 1.8.7
Please try this code: document.getElementById(reason_txt).innerHTML=enter some comments Anyway if your code works with Ruby 1.8.7, so why you don't like it ? Thanks, Sergii On Feb 23, 3:17 am, Zhimin zhiminz...@gmail.com wrote: Hi there, The following Watir (1.7.1) scripts, enter text in a textarea, ran fine with Ruby 1.8.7 browser = Watir::Browser.start(http://testwisely.com/demo/survey;) browser.text_field(:id, reason_txt).set(enter some comments) Returned error with Ruby 1.9.2p180 on Windows XP SP3 unknown property or method: `maxlength' (NoMethodError) HRESULT error code:0x80020006 Unknown name. from c:/rubyshell-1.9.2/ruby/lib/ruby/gems/1.9.1/gems/ watir-1.7.1/lib/wati/input_elements.rb:250:in `maxlength' Cheers, Zhimin -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Re: Need to get/retrieve value
So let's just go easy on the guy! It's not an entirely unreasonable request, and not really up to us to judge it. It may well be legit! Depending on the quality of the CAPTCHA it may in fact be possible. But you'd probably have to wrap in an OCR library with some image processing (to TIFF) beforehand. For image processing I'd recommend rmagick[1]. For OCR you could look at gocr[2], ocrad[3] or tesseract[4] [1] http://rmagick.rubyforge.org/ [2] http://jocr.sourceforge.net/ [3] http://www.gnu.org/software/ocrad/ [4] http://code.google.com/p/tesseract-ocr/ Good luck with that! Cheers, Tim On Wed, Feb 23, 2011 at 8:07 PM, Chuck van der Linden sqa...@gmail.comwrote: THERE IS NO SUCH GEM. NO. HELL NO. and a Thousand Times I tell you NO. The purpose of a captcha is a challenge to prove that it is a human at the computer, to prevented scripted attacks on the site from spammers and the like. The site cannot tell a scripted interaction from a tester from a scripted interaction from a spammer or other attacker. if the client needs you to test against production then you need to test pages with a captcha manually, or they would need to temporarily disable the captcha for the duration of the test, or set it to use a fixed answer for the duration of the test. You CANNOT script against a working captcha without a human in the loop. That's the design and purpose of a captcha. And if you somehow found a way to do that, then the client needs a better quality captcha, because if you can figure out a way, so will the spammers. NOBODY who isn't a spammer is likely to develop a means to get around captchas because we know it would then be immediately discovered and used BY spammers, and nobody wants to help spammers. Nobody here is going to help YOU do the same thing for the same reason, even if you are not a spammer, one could come along later and read the answer. stop trying to go there. Likewise, there is no way for the site to know your scripted interaction (against a production site) is 'safe' that would not potentially be used or exploited by spammers.. so I strongly discourage anything along those lines as it would just be introducing a chink in the sites defenses that could later be exploited to attack the site. If your client is asking you to write scripting against pages with captchas, point out to them that this is a bit like asking you to move an object they designed to be immovable. On Feb 22, 9:15 am, Aditya vaditya2...@gmail.com wrote: A good idea already thinking the same. But the client needs on production environment too. So do we have any gem atleast once the page is loaded can we get the value after page is displayed? Any idea ? On Tue, Feb 22, 2011 at 7:36 PM, Basim Baassiri ba...@baassiri.ca wrote: I've had a similar problem in automating a signup page that had a captcha on it. I solved it by implementing in the production code to detect the test environment and when the test environment was evaluated the captcha was hardcoded to QAQA and hence i used that string to proceed with the signup page Hopefully that can help you On Tue, Feb 22, 2011 at 5:30 AM, Aditya vaditya2...@gmail.com wrote: Thanks for the valuable information. Can i use rmagick gem in order to validate the captcha? and can i use it in watir? On Tue, Feb 22, 2011 at 3:50 PM, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Tue, Feb 22, 2011 at 11:17 AM, Aditya vaditya2...@gmail.com wrote: How do we handle in terms of automation? Captchas are made explicitly so they could not be automated. If I had to automate site that used Captcha, I would test them manually. Željko -- Before posting, please readhttp://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Before posting, please readhttp://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Before posting, please readhttp://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com- Hide quoted text - - Show quoted text - -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] detecting elements of Overlay form in watir
Hi all, How can we detect a overlay form using Watir. Say for example on http://www.microsoft.com/en/us/default.aspx there is a overlay form for downloading IE8. how to detect controls on this overlay form. thanks in advance. Inder Pal -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Re: Recent Stack Overflow Questions Tagged Watir
http://stackoverflow.com/questions/5085355/problem-connecting-to-localhost-with-watir -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] detecting elements of Overlay form in watir
I'm not entirely sure what you mean by overlay form, but on that page is a div that shows up for a bit to download IE8. It's simply a div with links. So something like browser.div(:id, 'lspTileContainer').link(:id, 'whatever').click Cheers, Charley Baker Lead Developer, Watir, http://watir.com On Wed, Feb 23, 2011 at 3:28 AM, Inder Pal Singh Parmar ipsp...@gmail.com wrote: Hi all, How can we detect a overlay form using Watir. Say for example on http://www.microsoft.com/en/us/default.aspx there is a overlay form for downloading IE8. how to detect controls on this overlay form. thanks in advance. Inder Pal -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Ruby 1.9.2: unknown method: 'maxlength' for textarea, fine with Ruby 1.8.7
Thanks for the reply. document.getElementById(reason_txt).innerHTML=enter some comments returns undefined method `innerHTML' for #Watir::TextField Anyway if your code works with Ruby 1.8.7, so why you don't like it ? This does not affect my work. I just wanted to test Watir readness for Ruby 1.9.2 using my exsiting Watir test suite. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Re: Ruby 1.9.2: unknown method: 'maxlength' for textarea, fine with Ruby 1.8.7
Let me know what problems you have with 1.9.2. I'll try to work on that soon. Report them on Jira. Cheers, Charley Baker Lead Developer, Watir, http://watir.com On Wed, Feb 23, 2011 at 4:31 PM, Zhimin zhiminz...@gmail.com wrote: Thanks for the reply. document.getElementById(reason_txt).innerHTML=enter some comments returns undefined method `innerHTML' for #Watir::TextField Anyway if your code works with Ruby 1.8.7, so why you don't like it ? This does not affect my work. I just wanted to test Watir readness for Ruby 1.9.2 using my exsiting Watir test suite. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Error on re-executing the script
Hi, I am getting the following error the moment I reconnect the device that is used for testing. Please help me to resolve it Thanks C:/Ruby186/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/ jssh_socket.rb:4 8:in `recv': An established connection was aborted by the software in your host machine. - recvfrom(2) (Errno::ECONNABORTED) from C:/Ruby186/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/ firewatir/jss h_socket.rb:48:in `read_socket' from C:/Ruby186/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/ firewatir/jss h_socket.rb:47:in `each' from C:/Ruby186/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/ firewatir/jss h_socket.rb:47:in `read_socket' from C:/Ruby186/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/ firewatir/jss h_socket.rb:6:in `js_eval' from C:/Ruby186/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/ firewatir/fir efox.rb:175:in `get_window_number' from C:/Ruby186/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/ firewatir/fir efox.rb:193:in `goto' from C:/Documents and Settings/admin/Desktop/Soft /Test cases/TC02.2.rb:217:in `performStep' from C:/Documents and Settings/admin/Desktop/Soft /Soft1.53.rb:620:in `callNext' from C:/Ruby186/lib/ruby/gems/1.8/gems/fxruby-1.6.20-x86- mingw32/lib/fox 16/responder2.rb:55:in `call' from C:/Ruby186/lib/ruby/gems/1.8/gems/fxruby-1.6.20-x86- mingw32/lib/fox 16/responder2.rb:55:in `onHandleMsg' from C:/Documents and Settings/admin/Desktop/Soft /Soft1.53.rb:769:in `run' from C:/Documents and Settings/admin/Desktop/Soft /Soft1.53.rb:769 -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Can Watir support PHP based technology?
Hi, As the fact is that php-based has no bearing on the way watir interacts with it, because php is all done server-side and watir only deals with the html that is delivered to the browser. I would like to know is there any way wherein a PHPs functionality be wrapped thereby letting Watir to use the PHP page HTML elements? Or any other alternative wherin watir dealing with the html can be delivered to the browser. Thanks :-) -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Problem in installing Flash Watir
Hi, While installing Flash_watir gem i received following exceptions Initially i tried i got following error. C:\Documents and Settings\jgem install flash_watir ERROR: Could not find a valid gem 'flash_watir' (= 0) in any repository ERROR: Possible alternatives: class_attr, flashplayer later i downloaded gem and installed at the following path: C:\Ruby187\lib\ruby\gems\1.8\cachegem install flash_watir ERROR: While executing gem ... (NoMethodError) undefined method `spec' for nil:NilClass Am i right? How do i get installed Flash_Watir My Gem version is 1.5.2 in 1 system and 1.3.7 in another. Do let me know on this asap. -- V -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com