[wtr-general] Re: Can I get the abscissa and longitudinal coordinates of a link/button/textfield on the page?
Watir generally works more with HTML rather than coordinates [I've never seen such fancy words for x and y :) ]. Is there a reason you're not going through html elements? If you have a link in the same frame or table or similar container element you can use .parent to get that container and maybe navigate to the flex button that way. If you're dead set on fixed coordinates, you should be able to use the code from the Right Click an Element page here: http://wiki.openqa.org/display/WTR/Right+Click+an+Element It provides you with methods to determine the top and left edges of an element, as well as the ability to left or right click at certain coordinates, which I assume you'll need if you don't directly get the element you're trying to click. -Dylan On Sep 3, 3:44 am, Wesley Chen cjq@gmail.com wrote: Hi, Guys, Now, there is a link on the page, can I get the abscissa and longitudinal coordinates of it? I would like to use that coordinates to locate a flex button beside it. Any suggestion would be quite appreciated. Thanks. Wesley Chen. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Code to select values in combo box
http://pettichord.com/watirtutorial/docs/watir_cheat_sheet/WTR/Cheat%20Sheet.html -DYLAN On Sep 2, 9:27 am, naveen kumar naveeenku...@gmail.com wrote: Hi Friends, I am new to ruby watir can any one send the code for selecting values is combo box please send me different WAYS OF SELECTING IT THANKS IN ADVANCE NAVEEN --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Check value of anonymous text field
You can look through \ruby\lib\ruby\gems\1.8\gems\watir-1.6.2\lib\watir \collections.rb for the types of collections that watir recognizes, as well as a good idea on how to add your own. -Dylan On Sep 2, 7:18 am, manar alalfi alalfi.ma...@gmail.com wrote: Thanks a lot for you all. The solution provided by Mark works pretty well, but I still have a question on how to generlize this to collect all other type of page elements, such as ( hidden, submit, radio,..), I tried things like, ie.hidden.each..., or the others and wont work!, So is there any other way to do this? Regards Manar On Sep 2, 6:17 am, Mark Anderson mander...@drillinginfo.com wrote: I don't think your call to #collect is doing what you expect. For each text field, puts is printing the details and returning nil. textF is then an array of nils with the same length as the number of text_fields. The documentation of the #collect command is available at: http://www.ruby-doc.org/core/classes/Array.html#M002187 It looks to me like you want all of the text fields. I think what you are looking for is something like: ie.text_fields.each {|tf| if tf.value != 'null' puts tf.name end } /\/\ark -Original Message- From: watir-general@googlegroups.com [mailto:watir- gene...@googlegroups.com] On Behalf Of manar alalfi Sent: Tuesday, September 01, 2009 12:23 PM To: Watir General Subject: [wtr-general] Check value of anonymous text field Hello, I want to print the name attribute of a text field in a page #collect Text fields elaments textF = ie.text_fields.collect {|tf | puts tf} # iterate to check for none_null_ name text field for tf in textF do if ie.text_field(:name, tf.name).value != 'null' puts tf.name.to_s end but the code gives an error: 3: undefined method `name' for nil:NilClass (NoMethodError) any help? Thanks __ Information from ESET NOD32 Antivirus, version of virus signature database 4387 (20090901) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 4388 (20090902) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 4388 (20090902) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com-Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Does Watir support PHP based technology
Specific examples of html and your watir code would be required to give more specific answers. The fact that it is 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 your browser. Also, I would recommend upgrading to the latest version of watir. -Dylan P.S. As far as I know there is no selection_box element type. http://pettichord.com/watirtutorial/docs/watir_cheat_sheet/WTR/Cheat%20Sheet.html On Sep 2, 10:37 am, rrash586 rrash...@gmail.com wrote: Thanks for ur reply . but the problem that i m facing while identifying the object like (selection_box,links,span,div,frame,forms) is that watir 1.5.1 is unable to identify the object and throwing error message saying unable to locate the object... I am doing the simple web testing of the application which is PHp based (like clicking on liks navigating to other page) But still watir is not able to locate the object. can u please let me know...if anything more i have to do Thanks in advance On Sep 2, 6:31 pm, Jason Trebilcock jason.trebilc...@gmail.com wrote: In addition to Željko's answer... Are there other modules required to be installed along with Watir? Short answer: No. Longer answer: It depends on what you want to do. If the sole focus of your testing is the web front-end, then you are probably safe not having to install any other gems. But, if you want to do things like connect to a database or connect to a remote machine, then there are gems that you might want to consider installing to better support those tasks. On Wed, Sep 2, 2009 at 7:41 AM, rrash586 rrash...@gmail.com wrote: Hi All, I am new to watir and want to evaluate one web apps which is PHP based.Does watir support PHP based technology .Please let me know I does there any other modules require to install alongwith watir. I m using watir Watir 1.5.1. Does there any link for knowing the thingfs more Thanks in advance- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Check value of anonymous text field
Is there a reason you're changing how you access them between the two codes? in your first one (where you can find the text field) you have puts tf.name, where in the second one where you cant find it you have ie.text_field(:name, tf.name).set watir Why not just stick with tf.set watir ? ie.text_fields.each{|tf| tf.set(watir) if(tf.value != and tf.name !=) } Of course, thats going to go through and change any text field to watir whenever it has a name value and there's already text in it, and I have no idea why you would want to do that. :) -Dylan Thanks, thats works fine. However Using the following code ie.text_fields.each {|tf| if tf.value != 'null' puts tf.name end } I was able to access the field for read. I tried to set the field as follows, but it is not able to locate the element! ie.text_fields.each {|tf| if tf.value != 'null' if tf.name != 'null' ie.text_field(:name, tf.name).set watir end end } So kindly, what do you think is the problem? On Sep 2, 10:23 am, Dylan mej...@gmail.com wrote: You can look through \ruby\lib\ruby\gems\1.8\gems\watir-1.6.2\lib\watir \collections.rb for the types of collections that watir recognizes, as well as a good idea on how to add your own. -Dylan On Sep 2, 7:18 am, manar alalfi alalfi.ma...@gmail.com wrote: Thanks a lot for you all. The solution provided by Mark works pretty well, but I still have a question on how to generlize this to collect all other type of page elements, such as ( hidden, submit, radio,..), I tried things like, ie.hidden.each..., or the others and wont work!, So is there any other way to do this? Regards Manar On Sep 2, 6:17 am, Mark Anderson mander...@drillinginfo.com wrote: I don't think your call to #collect is doing what you expect. For each text field, puts is printing the details and returning nil. textF is then an array of nils with the same length as the number of text_fields. The documentation of the #collect command is available at: http://www.ruby-doc.org/core/classes/Array.html#M002187 It looks to me like you want all of the text fields. I think what you are looking for is something like: ie.text_fields.each {|tf| if tf.value != 'null' puts tf.name end } /\/\ark -Original Message- From: watir-general@googlegroups.com [mailto:watir- gene...@googlegroups.com] On Behalf Of manar alalfi Sent: Tuesday, September 01, 2009 12:23 PM To: Watir General Subject: [wtr-general] Check value of anonymous text field Hello, I want to print the name attribute of a text field in a page #collect Text fields elaments textF = ie.text_fields.collect {|tf | puts tf} # iterate to check for none_null_ name text field for tf in textF do if ie.text_field(:name, tf.name).value != 'null' puts tf.name.to_s end but the code gives an error: 3: undefined method `name' for nil:NilClass (NoMethodError) any help? Thanks __ Information from ESET NOD32 Antivirus, version of virus signature database 4387 (20090901) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 4388 (20090902) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 4388 (20090902) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com-Hidequoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: customize xml generated by ci_reports
Using the base ci_reporter install, the report_manager.rb file has an variable called @basename, which gets the suite name added onto it in the File.open call in write_report. To add date/time to this just add Time.now.strftime(put your time formatting here) to the end of the string in the File.open call. It should look something like this: http://pastie.org/601390 -Dylan On Aug 31, 9:47 pm, Marlon marlonmoja...@gmail.com wrote: Hi, how can I rename the filename of the xml created by ci_reporter? I need a repository and store the test results generated. ex. TEST- Class NameDate/Time.xml. Which part of the ci_reporter does the filenaming/file creation? Please help Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Reading special characters
Also, you can get around the special character (so you dont have to look each one up) by using a regex and the regular text: browser.text.include?(/Previous/) browser.span(:text,/Previous/).click On Sep 1, 6:52 am, GJHmf graham.harb...@webroster.net wrote: How annoying; I thought I had tried and failed on that very solution, now it works. My hands are up, it must have been a typo of some sort on my part. Once again, thanks Željko. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: after massive watir crawl..
Well, if you're crawling tens of thousands of pages you might have picked up a nasty bug somewhere along the way. I would run some virus scans. Also run some network diagnostics (try pinging some sites, etc...) -Dylan On Aug 29, 8:04 am, curious csamigr...@gmail.com wrote: I have massive WATIR based crawling going on.. I am crawling many tens of thousands of pages. Now after this massive crawl, my internet is getting stuck. Internet is not loading the pages anymore.. and it is just saying 'loading' message, and not proceeding to the next page. I have cleared away / deleted all 'history / temporary files / cookies' in Internet browser - tools / options, but the problem still persists. I have tried the same WATIR crawling in another computer with the same internet connection, and in this another computer, internet access is just fine. But in this computer with massive crawling, internet pages are not loading. not only the pages I am crawling, but also any internet pages are not loading. looks to me that something must be stuck somewhere, and I need to clear that away, but I don't know what I need to clear away.. I restarted the computer, but the problem does not go away. Could anyone tell me what I need to clear away in order to have smooth internet access?? thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Not able to enter login credentials in Sign In section
Well, your code isn't finding the sign in text fields in the first place. Are you sure that the name value for those fields are Email and Passwd? Keep in mind the name field is specifically declared, it isn't just whatever text is nearby. Also, it looks like the first frame is called signup, so the text_field elements might be in there. You could try: $ie.frame(:index,1).text_field(:name,Email).set(a) frames hide their html from the parent frame/window, so if the login fields are in a frame, looking for the fields in the main window wont work. -Dylan On Aug 26, 4:55 am, Maumita maumita.majum...@gmail.com wrote: Hi, This is a test site https://sandbox.google.com/checkout/view/buy? o=shoppingcartshoppingcart=322449560105091pli=1tzfp=wg-14ArD In this I am not able to enter login credentails in the Sign In section. -- require 'watir' require 'test/unit' require 'win32ole' $ie = Watir::IE.new test_site='https://sandbox.google.com/checkout/view/buy? o=shoppingcartshoppingcart=322449560105091pli=1tzfp=wg-14ArD' $ie.goto(test_site) $ie.show_frames $ie.text_field(:name, Email).set(a) #$ie.text_field(:name, Passwd).set('b') -- $ie.show_frames - it shows -- there are 2 frames frame index: 1 name: signup frame index: 2 Access Denied, seehttp://wiki.openqa.org/display/WTR/FAQ#access-denied d:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/element.rb:52:in `assert_exists': Unable to locate element, using :name, Email (Watir::Exc eption::UnknownObjectException) from d:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ element.rb:284:in `enabled?' from d:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ element.rb:56:in `assert_enabled' from d:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ input_elements.rb:323:in `set' from D:/ruby/samples/RubySrc-1.8.6-p111/sample/ DriverCentral_Scripts/test/t.rb:11 --- Please help how can I enter login credentials in Sign In section. Thanks Maumita --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Watir fire_event that opens a modal dialog no wait needed
More details are probably required. What action is performed instead, for instance? On Aug 25, 12:51 am, Adrian Ghidu agh...@gmail.com wrote: Sorry for the late reply, but the fire_event_no_wait method is not working: the expected action is not performed. Thanks On Thu, Jul 30, 2009 at 5:26 PM, Adrian Ghidu agh...@gmail.com wrote: I will definitely try that. Thanks Tony On Thu, Jul 30, 2009 at 5:03 PM, Tony ynot...@gmail.com wrote: Hi Adrian, You could add another method to the element.rb file in watir (below fire_event method) - def fire_event_no_wait(event) assert_enabled highlight(:set) object = #{self.class}.new(self, :unique_number, # {self.unique_number}) �...@page_container.eval_in_spawned_process(object + .fire_event(\# {event}\)) highlight(:clear) end Now you can call fire_events without waiting ... button.fire_event_no_wait(onmousedown) Thanks, Tony --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: onMouseover
Off the top of my head, I would try $b.image(:alt,prev).click If that doesn't work, give us some more info on the html and on what happens when you run those commands. Is it actually clicking on the image and its just not firing any events, or is it throwing an error that it can't find the image? -Dylan On Aug 25, 2:05 pm, sd qajan2...@gmail.com wrote: Hi, I have an item. Once I mouseover that item, I get an image which I need to click on. I used fire_event(onMouseover) which shows me the button which is an image, but I need to click on that image. Using .click on that image was not very successful. Does anyone have any suggestions? Exact code I used: $b.link(:href = /aa/, :index = 8).fire_event(onMouseover) $b.button(:alt, prev).click Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: customize xml generated by ci_reports
To view the results html-like you have to create an xsl stylesheet to format the xml data. Then add ?xml-stylesheet type=text/xsl href=stylesheet.xsl? to the top of your results file(s). Then you can just open the xml file and it will open fully formatted. Here's the xsl stylesheet I use: http://pastie.org/593268 It probably wont work for you because I've made some changes to how the reporter outputs the xml file, but it should give you the basic idea. -Dylan On Aug 23, 11:52 pm, Test Test checktestingthi...@gmail.com wrote: Tony, I have added Class.Attr contents and now its working fine but my requirement is to get report(s) in html format not xml. Please help. Thanks D G On Jul 24, 4:04 pm, pallavi shashidhar pals.sha...@gmail.com wrote: Hi Tony, I think i used the previous code inhttp://pastie.org/554062insteadofhttp://pastie.org/554831 It is now working fine for me. Thanx for all your replies. Regards, Pallavi On Fri, Jul 24, 2009 at 3:28 PM, Tony ynot...@gmail.com wrote: Hi Pallavi, When using your modified file, you dont need to require ci_reporter nor need to have it installed. Just require the modified file. require 'watir' #require 'ci/reporter/test_suite.rb' require 'YOUR MODIFIED FILE' class TC_TEST_suite Test::Unit::TestCase def test_a_search test_site = http://www.google.com; browser = Watir::Browser.new browser.goto test_site browser.text_field(:name, q).set pickaxe browser.button(:name, btnG).click end end Thanks, Tony --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: How do I get a URL parameter value
Can you do $ie.frame(:index, 1).src ? -Dylan On Aug 17, 11:09 pm, Marlon marlonmoja...@gmail.com wrote: Im getting an error retrieving src value which is https://url.com/ text.asp?p=xyzq=abc using attribute_value() code: $ie.frame(:index, 1).attribute_value(src) Error: NoMethodError: undefined method `attribute_value' for #Watir::Frame: 0xfdbec50 thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: How do I get a URL parameter value
I was just offering another way he might do it. I'm not at my machine w/ ruby/watir so I cant test it right now. =Dylan On Aug 18, 12:28 am, Raveendran P jazzezr...@gmail.com wrote: Hi Dylan, *Way 1:* Please provide the code/site URL I will try and let u know *Way 2:* puts $ie.frame(:index, 1).methods.sort Search the output contains src method or not ? Thanks On Tue, Aug 18, 2009 at 12:18 PM, Dylan mej...@gmail.com wrote: Can you do $ie.frame(:index, 1).src ? -Dylan On Aug 17, 11:09 pm, Marlon marlonmoja...@gmail.com wrote: Im getting an error retrieving src value which is https://url.com/ text.asp?p=xyzq=abc using attribute_value() code: $ie.frame(:index, 1).attribute_value(src) Error: NoMethodError: undefined method `attribute_value' for #Watir::Frame: 0xfdbec50 thanks -- Regards, P.Raveendranhttp://raveendran.wordpress.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: how to click link with CTRL key pressed in watir?
http://wtr.rubyforge.org/rdoc/classes/Watir/IE.html#M000256 -Dylan On Aug 16, 11:32 pm, Bhavesh bhavesh1_sha...@yahoo.com wrote: Actually currently i press CTRL key manually and then the link, it gets opened. But while automating how can i do this? Plz dont suggest to remove pop-blocker as i have already done whatever i can, now i have soem restriction from my office side. So i need to send CTRL+link click. Can anybody help me in this regard. Bhavesh --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Is there anyway to wait until all images of a page is not loaded properly.
Try something like: Water::Waiter.new(10).wait_until{$ie.image(:id,imgid).exist?} using one of the images. -Dylan On Aug 17, 7:18 am, Maumita maumita.majum...@gmail.com wrote: Hi, I have written a script to capture the page download time. The page has different shopping item images along with their price details. The script capture the time and stops when the page layout (page framework) is loaded completely .It doesn't include the images of all the shopping items. I observed that, once the page framework is loaded completely then Done message appears on the status bar, after that it starts rendering the shopping item images one by one.Once all the shopping images is loaded then again it says Done on status bar (checked in browser IE) Is there any way , my scripts will not stop after the 1st Done. It will wait until all the images is not loaded. I checked the same behavior with website like -Amazon. I can't use sleep()..because it will not work always if network connection is very slow. This is urgent.Please help. Thanks Maumita --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: How can i click CTRL key + Link in Watir
See my reply to your other message, and please only create one discussion per topic at a time, thanks. :) -Dylan On Aug 17, 12:05 am, Bhavesh bhavesh1_sha...@yahoo.com wrote: Hi , I have to click CTRL key + link using watir. Is anybody know how to do it? Actually i can tmodify any setting in IE, os i have to press CTRL key manually and then link to open an link. But for automation, i have to do it using WATIR Any help is appreciated. Bhavesh --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: IE.attach doesn't work properly in the script
This might not be your issue, but have you tried adding a require watir/ie line? If that doesn't help, please provide information on what versions of watir and ruby you're using. -Dylan On Aug 16, 10:17 pm, balbao ramkrishn...@gmail.com wrote: Folks, Have any of you faced similar kind of issue ?. This is a blocker for me...Need help. On Aug 14, 12:04 pm, balbao ramkrishn...@gmail.com wrote: HI, In my application, to enter a date for a field, we need to do it using the calendar icon. This is the only option to enter data in that field. The code i wrote for this is $ie.image(:src, /calendar/).click sleep(7) $ie2 = Watir::IE.find(:title, /Calendar/) $ie2.select_list(:id, /month/).select('June') $ie2.text_field(:id, /year/).set('2008') sleep(3) $ie2.link(:index, 22).click I tried this in IRB and it worked fine. Nevertheless, when i inserted this into script, after selecting the month [$ie2.select_list(:id, / month/).select('June') ], the script execution ceased. No error was thrown even after one hour. I got this error, after closing the console manually Exit code: -1073741510. Not sure, why this surfaced. My hunch is that the console is expecting some sort of response. Balbao. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Is there any way to run a watir script automatically in every hour.
For Problem 1, its not elegant and there's probably a better way to do it, but you could create an array with all the id's of the images you need loaded, then do something like this: imgarr.each{ |img| Watir::Waiter.new(20).wait_until{ie.image(:id,img).exist?} } I think this will go through each image and wait till it exists. If an image doesn't get loaded in 20 seconds it will throw a Timeout Exception. I've had a lot of problems with the way Watir waits for things and haven't really found a good solution overall. -Dylan On Aug 12, 1:52 am, Tony ynot...@gmail.com wrote: Hi Maumita, 1. Not sure on this. 2. You can add your scripts to a batch file and run the batch file from task scheduler. Thanks, Tony --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Right Click
Thanks! I had been so focused on a fire_event solution I totally spaced on this one. I had to alter it a bit, since that moves the cursor to the upper left hand corner of the element, which wasn't bringing up the specific right-click menu from inside the element. I added xoffset and yoffset as variables passed to right_click (with defaults of 0) so I can move the mouse into the element more with a call like ie.element(:id,//).right_click(30,10) Thank you so much for your help, I can't believe I missed that. :) -Dylan On Aug 12, 3:16 pm, tcfodor tcfo...@comcast.net wrote: Hi Dylan! Check here: http://wiki.openqa.org/display/WTR/Right+Click+an+Element Hope it helps! -Tiffany On Aug 12, 4:01 pm, Dylan mej...@gmail.com wrote: Hey all. I've scoured the group and the internet at large and haven't found a definitive answer on how to right-click an element. I've tried fire_event(oncontextmenu), and in some cases it has worked, but in the case I'm working on right now it doesn't. Is there a straightforward way to directly right click an element or am I out of luck? Thanks! -Dylan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: How to fill the info in the TEXTAREA?
The text_field element should also work for text areas. -Dylan On Aug 12, 9:18 pm, yuping zhong littlezhong...@gmail.com wrote: Dear All, I am a new user of Watir. It is known to all that fills the info in the text_field is easy. But how to fill the info in the TEXTAREA? I give more info for about this TEXTAREA in the picture. Hope someone can help me. Many thanks! -Zhong how+to+fill+info+in+text+area.png 55KViewDownload --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: How to run 2 different scripts at the same time?
Did you look at the link I posted? It shows you how to do this. Here's an example for running two google searches at the same time: require 'watir' require 'watir/ie' def test_google1 ie = Watir::IE.start('http://www.google.com') ie.text_field(:name, q).set(Test) ie.button(:value, Google Search).click ie.close end def test_google2 ie = Watir::IE.start('http://www.google.com') ie.text_field(:name, q).set(Other Test) ie.button(:value, Google Search).click ie.close end threads = [] threads Thread.new{test_google1} threads Thread.new{test_google2} threads[0].join threads[1].join -Dylan On Aug 10, 10:30 pm, Marlon marlonmoja...@gmail.com wrote: for example: require 'thread' require 'watir' class search def test_google ie = Watir::IE.start('http://www.google.com') ie.text_field(:name, q).set(pickaxe) ie.button(:value, Google Search).click ie.close end def test_yahoo ie = Watir::IE.start('http://www.google.com') ie.text_field(:id, p).set(pickaxe) ie.button(:id, searchsubmit).click ie.close end end threads = [] how can I run this 2 def at the same time? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: How can I add a new method to Watir::Radio?
Try looking at where the radio methods are defined in watir, that should give you a clue. In input_elements.rb, the declaration of Radio functions look like this: Module Watir class Radio RadioCheckCommon def myMethod puts this is my method end end end -Dylan On Aug 11, 12:56 am, John Kolokotronis johnj...@gmail.com wrote: Hi All, I thought my understanding of Ruby classes was getting a bit better but I can't seem to add a new method to Watir::Radio, without breaking all functionality for radio buttons... E.g. I tried adding a dummy method like this: class Watir::Radio def myMethod puts this is my method end end When I then call the method or any other existing method, like isSet?, I get error messages about the number of arguments given: wrong number of arguments (4 for 0) whenever I try to call any method from the Watir::Radio class. What I'm doing wrong? How can I extend Watir::Radio, without messing with the main watir.rb files? Thanks in advance. Regards, John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: How can I add a new method to Watir::Radio?
Try adding require 'watir/ie' after your require 'watir' line -Dylan On Aug 11, 2:03 am, John Kolokotronis johnj...@gmail.com wrote: Thanks - I noticed the Radio class is in input_elements.rb and tried the structure you suggested before my original post: module Watir class Radio RadioCheckCommon def myMethod puts this is my method end end end But this just generates another error: uninitialized constant Watir::RadioCheckCommon (NameError) And the script can't be executed at all then... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: please let me know how to identify whether the chechk box present in the page is checked or unchecked
The only way I have been able to find is that the HTML of the checkbox changes when it is checked, adding CHECKED in there somewhere. You can check the html: checkbox(:id,YourID).html =~ /CHECKED/ Or you can add this function to your input_elements.rb file in the watir gem under the CheckBox class: def checked? return true if(self.html =~ /CHECKED/) return false end then you can used the checked? method. Hope this helps! -Dylan On Aug 10, 2:56 am, ravilla lavanya.ravi...@gmail.com wrote: I got one problem while running the automation script: I am having 20 checkboxes in a page .NOw i want check that whether each check box is checked or unchecked.if it is checked i want to print a message. Snippet of code that i used is: require 'watir' require 'win32ole' require'rubygems' ie=Watir::IE.start(http://qa.irma.icat.com/inspwebapp;) sleep(1) #~ ie.bring_to_front ie.maximize #to login to the application ie.text_field(:name, username).set(mmanager) ie.text_field(:name, password).set(pass) ie.image(:alt,Log In To ICAT).click ie.link(:text, Home).click # to check all the check boxes ie.button(:value, Select All).click #check boxes are present inside a table under the mentioned div ter=ie.div(:class,mainContent).table(:index,8) count=ter.row_count() putstotal count of table#{count} i=3 #l loop to pass through all the row of the table while i = count do puts#{i} # this the condition which i used to verify whether the check box is checked or not if ((ter[i][1].checkbox(:name,selections).set)!=false) putsCheck box is not checked else putsCheck box is checked end i+1 end thanks in advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: How to run 2 different scripts at the same time?
You can do this in ruby with threads (http://ruby-doc.org/core/classes/ Thread.html) although you need to be very careful that the two threads don't interfere. -Dylan On Aug 10, 7:44 pm, Marlon marlonmoja...@gmail.com wrote: Hi, anyone here knows how to run multiple scripts at the same time? I wanted run for example 2 different scripts concurrently, Thanks in advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Issue with a PopUP and Click_No_Wait
which version of 1.86? :) I know its confusing, but 1.86 - 27 does not work with click_no_wait, while 1.86 - 26 does. You can download it here: http://rubyforge.org/frs/download.php/29263/ruby186-26.exe -Dylan On Aug 9, 10:20 am, Pallavi Sharma write2pall...@gmail.com wrote: I am using ruby 1.86 and watir 1.6.2 Can you please send me your script, somehow it keeps failing for me and i am not able to see the pop up. I would really appreciate a quick reply. Thanks for the quick reply.. On Sun, Aug 9, 2009 at 5:11 PM, Smruti Ranjan Kar smrutiranjan@gmail.com wrote: Hi Pallavi, That click_no_wait worked fine for me. Just check your Ruby version. (click_no_wait does not work with ruby186-27_rc2: known defect) I am using Ruby186-26_Watir1.6.2 On Sun, Aug 9, 2009 at 1:28 PM, Pallavi Sharma write2pall...@gmail.comwrote: Hi Need some urgent help: Go to link: https://www.kaplanprofessional.edu.au/smartforms/courseonline.asp 1. Click on New Student 2. Fill in Mandatory details 3. Click Next 4. Chose Financial Planning 5. Click Next 6. Chose first option in both select lists 7. Select radio button Distance Eductaion 8. Click on Add Subject 9. Click Next and a popup will appear. Now, when i use click_no_wait with the NEXT button it doesn't shows the Pop UP When i use Click with the NEXT button it holds coz now the pop up appears. Can anyone here please tell me how to proceed with the scenario. Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Verify does not work while checking the links.
Well, I'm not sure if this is your problem but that isn't a global variable, its an instance variable. Global variables start with $ -Dylan On Aug 5, 2:51 am, Yuvraj yuvrajjagad...@gmail.com wrote: Hi, I have installed the ruby 1.8.6 and WATIR 1.6.2. I am checking whether a link is active or not with the following verify statement. verify((browser.link(:text, 1).exists?), message=Link not active.) The above statement works fine. But when I use the above statement with global variable as shown below it does not work and pass everytime whether the link is active or not. verify((@browser.link(:text, 1).exists?), message=Link not active.) In the above case I am getting the @browser from common file as shown below. # Calling function url to open specific site browser @browser = url() And common file has following code. # This function open the browser and navigate to site def url() browser = Watir::Browser.new browser.goto http://www.acs.org; return browser end Is there any other way through which I can check the same thing? Thanks Regards Yuvraj --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: graph/charts
I would ask generic ruby questions here: http://groups.google.com/group/comp.lang.ruby/topics -Dylan On Aug 4, 12:38 pm, anna barbara ostrowska ab.ostrow...@gmail.com wrote: Hi there, Can you recommend me any tool/ruby library that allows me convert data (metrics) to graph/charts ect? Thanks in advance. Anna --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Problem setting select_list using an array index
Your welcome! A good thing to do when you're using variables that aren't being accepted like you think they should be is to output them to the screen right before you use them (print org[0]), that way you know exactly what value is getting used. -Dylan On Aug 3, 6:21 am, infoDrone xrandywe...@yahoo.com wrote: This worked perfectly! Thank you, this was one of my first attempts at IO with Ruby :) On Jul 31, 6:52 pm, Dylan mej...@gmail.com wrote: Have you stripped the newlines when you get the input? The way you have it now, $org is ['Coke\n','Pepsi\n','Sprite\n'] Also, is there a reason $org is a global variable? Having global vars can be dangerous if they're not needed. You might try something like this: org=[] def get_orgs(org) f=File.open(orgs.txt,r) f.each{|line| org.push line.gsub(\n,)} f.close return org end org=get_orgs(org) ie.select_list(:id,'id').select(org[0]) -Dylan On Jul 31, 2:58 pm, infoDrone xrandywe...@yahoo.com wrote: I have a select_list with values of Coke, Pepsi, and Sprite. I need to set the value to Coke using an array index as follows: ie.select_list( :id, 'id' ).select( #{$org[0]} ) I have a function get_orgs that builds the $org[] array by reading lines from a text file in the same directory, as follows: def get_orgs f = File.open(orgs.txt, r) f.each_line {|line| $org.push line } f.close end The orgs.txt file contains three lines as follows: Coke Pepsi Sprite The problem is, when I run this, I get c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/input_elements.rb: 82:in `select_item_in_select_list': No option with text of Coke (Watir::Exception::NoValueFoundException) But if I build the array as $org = [Coke, Pepsi, Sprite] then there's no problem. What's the problem here? Isn't the array exactly the same either way? Thanks Randy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Error while retrieving an integer from spreadsheet
Add .to_i in the middle there, because like you said you aren't getting an integer back, so you have to make it one. So you end up with: $regno = oo.cell(row,6).to_i.to_s -Dylan On Aug 3, 8:52 am, balbao ramkrishn...@gmail.com wrote: HI, Am a novice in Watir and have a problem in retrieving an integer from spreadsheet. require watir require rubygems require 'win32ole' require 'Win32API' require 'roo' $ie = Watir::IE.new url = https://qaenv:7001/login; $ie.goto(url) def value(file, sheet) oo = Openoffice.new(file) oo.default_sheet = sheet header_row = oo.first_row row = header_row+1 column = oo.first_column $service_name = oo.cell(row,2) $first_name = oo.cell(row,3) $last_name = oo.cell(row,4) $company_name = oo.cell(row,5) $regno = oo.cell(row,6). # I need to feed in an integer in this field. end filename = D:\\Ruby\\Data File\\datafile.ods sheetname = Data I get C:/RUBY/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ input_elements.rb:390:in `limit_to_maxlength': undefined method `length' for 51835430479.0:Float (NoMethodError) from C:/RUBY/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ input_elements.rb:367:in `type_by_character' from C:/RUBY/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ input_elements.rb:334:in `set' from order_flow.rb:75:in `customer_creation' from order_flow.rb:94 . If i try converting it to string, like this $regno = oo.cell(row, 6).to_s it returns a float, i.e 12345 will get converted to 12345.0 which is an invalid input to the company field. Balbao --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Watir Install/Basic Error, It doesn't launch browser
I would try uninstall/reinstalling and running gem update --system beforehand so you have the latest version of rubygems before you try installing watir. I promise nothing, though! :) -Dylan On Aug 2, 8:12 pm, DF df.tra...@gmail.com wrote: I am totally new and just trying to learn and do basic staff. I installed RC2 Ruby and Watir. ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] While running gem install watir got this error: Installing ri documentation for builder-2.1.2... ERROR: While generating documentation for builder-2.1.2 ... MESSAGE: Unhandled special: Special: type=17, text=!-- HI -- ... RDOC args: --ri --op C:/Ruby/lib/ruby/gems/1.8/doc/builder-2.1.2/ ri --title Builder -- Easy XML Building --main README --line-numbers --quiet lib CHANGES Ra kefile README doc/releases/builder-1.2.4.rdoc doc/releases/ builder-2.0.0.rdoc do c/releases/builder-2.1.1.rdoc --title builder-2.1.2 Documentation (continuing with the rest of the installation) Overall I thought it installed. Then I tried to run Marick's script from his book: watir.rb --- # Excerpted from Everyday Scripting in Ruby # We make no guarantees that this code is fit for any purpose. # Visithttp://www.pragmaticprogrammer.com/titles/bmsftfor more book information. #--- require 'test/unit' require 'watir' include Watir # You don't need to understand this to understand the test. # See the chapter on modules if you want to. class WatirExample Test::Unit::TestCase def test_marick_vanity ie = IE.new # Launch Internet Explorer ie.goto('http://www.google.com') irb # If you view the HTML source, you can see that Google # names the search field 'q'. ie.text_field(:name, q).set(scripting for testers) # 'btnI' is the name of the I'm Feeling Lucky button. ie.button(:name, btnI).click # Case-insensitive search for my name. assert(ie.contains_text(/marick/i)) end end And I got these errors: C:\Rubyc:\Test\RubyBook\code\scraping-alternatives\watir.rb Loaded suite c:/Test/RubyBook/code/scraping-alternatives/watir Started E Finished in 2.484 seconds. 1) Error: test_marick_vanity(WatirExample): MissingSourceFile: no such file to load -- safariwatir C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/ active_support/core_e xt/module/introspection.rb:70:in `const_get' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/ active_support/core_e xt/module/introspection.rb:70:in `local_constants' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/ active_support/core_e xt/module/introspection.rb:70:in `each' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/ active_support/core_e xt/module/introspection.rb:70:in `local_constants' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/ active_support/core_e xt/module/introspection.rb:68:in `each' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/ active_support/core_e xt/module/introspection.rb:68:in `local_constants' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/ active_support/core_e xt/module/introspection.rb:86:in `local_constant_names' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/ active_support/depend encies.rb:498:in `new_constants_in' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/ active_support/depend encies.rb:495:in `collect' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/ active_support/depend encies.rb:495:in `new_constants_in' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/ active_support/depend encies.rb:156:in `require' C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.3/lib/ active_support.rb:57 C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_origina l_require' C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ non_control_elements.rb :1 C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_origina l_require' C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie.rb:82 c:/Test/RubyBook/code/scraping-alternatives/watir.rb:14:in `test_marick_vani ty' 1 tests, 0 assertions, 0 failures, 1 errors It didn't even open the browser. Then I started to run from irb with step by step script: irb(main):002:0 require 'watir' = true irb(main):003:0 test_site=http://www.google.com; = http://www.google.com; irb(main):004:0 ie=Watir::IE.new = #Watir::IE:0x2c0a498 @rexmlDomobject=nil, @logger=#Watir::DefaultLogger:0x2 bb1ce4 @level=2, @formatter=#Logger::SimpleFormatter:0x2bb0f9c @datetime_format =%d-%b-%Y %H:%M:%S, @default_formatter=#Logger::Formatter: 0x2bb1ca8 @datetim e_format=nil, @progname=nil, @logdev=#Logger::LogDevice:0x2bb18c0 @mutex=#Log ger::LogDevice::LogDeviceMutex:0x2bb1730
[wtr-general] Re: Getting an error saying undefined method `length' when trying to use date in a text field.
Date.today() returns a Date object, while .set requires a string. Somewhere in the set function it is trying to get the length of the string it was passed, which is why you're getting that error. You might try something like: ie.text_field(:name,q).set #{today} -Dylan On Aug 3, 10:18 am, moorecats suh...@gmail.com wrote: I am new to Watir/Ruby. Sorry about this noob question - I am trying to use the date in a text field. Using my script (pasted below). I get the error - I am not sure what I am doing wrong in this case. Any help would be greatly appreciated. C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/input_elements.rb: 390:in `l imit_to_maxlength': undefined method `length' for Mon, 03 Aug 2009:Date (NoMetho dError) from C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ input_elements .rb:367:in `type_by_character' from C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ input_elements .rb:334:in `set' from trying.rb:12 +++ +++ require 'rubygems' require 'watir' require 'date' ie = Watir::IE.new today = Date.today() ie.goto('http://www.google.com') ie.text_field(:name, q).set today --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Problem setting select_list using an array index
Have you stripped the newlines when you get the input? The way you have it now, $org is ['Coke\n','Pepsi\n','Sprite\n'] Also, is there a reason $org is a global variable? Having global vars can be dangerous if they're not needed. You might try something like this: org=[] def get_orgs(org) f=File.open(orgs.txt,r) f.each{|line| org.push line.gsub(\n,)} f.close return org end org=get_orgs(org) ie.select_list(:id,'id').select(org[0]) -Dylan On Jul 31, 2:58 pm, infoDrone xrandywe...@yahoo.com wrote: I have a select_list with values of Coke, Pepsi, and Sprite. I need to set the value to Coke using an array index as follows: ie.select_list( :id, 'id' ).select( #{$org[0]} ) I have a function get_orgs that builds the $org[] array by reading lines from a text file in the same directory, as follows: def get_orgs f = File.open(orgs.txt, r) f.each_line {|line| $org.push line } f.close end The orgs.txt file contains three lines as follows: Coke Pepsi Sprite The problem is, when I run this, I get c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/input_elements.rb: 82:in `select_item_in_select_list': No option with text of Coke (Watir::Exception::NoValueFoundException) But if I build the array as $org = [Coke, Pepsi, Sprite] then there's no problem. What's the problem here? Isn't the array exactly the same either way? Thanks Randy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Getting text between two br / tags
Well, if the only text that is variable is the text within the a/a tags, are there any identifying marks for that link? an id? Otherwise, I suppose you could just get the text for the whole page and subtract the text you already know (i.e. the non-variable text). Not pretty or elegant, but it would get the job done. -Dylan On Jul 29, 12:47 pm, Aaron MacDonald aa...@genieknows.com wrote: There is a line of text that I want to extract. It is found in some HTML that follows this pattern: a href=...img src=...//abr/ !-- An image link -- Some text br/ a href=...Another link (variable text)/a br/ Text I want to extract. br/ Updated by a href=...name (variable)/a X hours ago [a href=...Comment/a] I have the impression that I'd use XPath somehow, but am unsure how to proceed since the text I want isn't in any page element. - Aaron --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: can Watir run in remote webserver with linux OS??
Don't see why not. Might be dangerous, depending on what sites you end up crawling, but a recursive loop should do the trick. You'll have to use something like FireWatir, unless you have IE on your linux web server :) -Dylan On Jul 27, 8:32 pm, Joeyjoey dorik...@gmail.com wrote: hi there, i have a remote linux web server can i use Watir, for say crawling websites ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Open source tool for window apps
http://www.autoitscript.com/autoit3/ -Dylan On Jul 28, 11:34 am, venky venkatesh...@gmail.com wrote: Hi, Is there any open source tool to automate window based application? Thanks, Venkathttp://prog2impress.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: How to access input boxes defined in an iframe
I would try browser.frame(:src,xyz).div(:id,/.*/).text_field (:id,abc123) -Dylan On Jul 22, 11:14 pm, basu bas.go...@gmail.com wrote: Hi , HTML structure is like this, html body div iframe src=xyz html body div input id=abc123 input id=efg456 /div /body /html /iframe /div /body /html I tried acessing the input boxes like this, 1. browser.frame(:src, xyz).text_field(:id, abc123) 2. browser.frame(:index, 1).text_field(:id, abc123) both the ways i getting text_field method not found error i tried browser.frames() which is returning win32ole object, i am not sure how to access elements, could some one plz help ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: customize xml generated by ci_reports
If I am understanding your question correctly, one method would be to use Tony's modified reporter file and put each project in its own test suite. This would produce 1 xml file with each project in its own testcase/testcase tags. Doing this with the original CI_Reporter will create a separate xml file for each suite -Dylan On Jul 23, 2:48 am, pallavi shashidhar pals.sha...@gmail.com wrote: Hi there, Am using Ci_reporter (not the one you have mentioned. The original one.) I have an ERP suite which has watir scripts of various projects under it: This is the structure: ERP - stores - works - payroll - financials When i run them as a suite all the testcases are run and there is a single XML report in Test folder which gives the list of all the testcases of all projects. Is there a way to separate out the reporting for individual projects? like : Stores : Testsuite(32) with results Works : Testsuite (3) with results and so on? Regards, Pallavi On Thu, Jul 23, 2009 at 2:32 PM, Tony ynot...@gmail.com wrote: Hi Marlon, Now you dont need to use require 'ci/reporter/rake/ test_unit_loader.rb' Instead only require the modified file. Thanks, Tony --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: customize xml generated by ci_reports
I just removed the require 'ClassAttr.rb' line and copy-pasted the ClassAttr code into the top of Tony's modified reporter file. -Dylan On Jul 22, 8:11 pm, Marlon Mojares marlonmoja...@gmail.com wrote: Hi, I'm still encountering no such file to load -- ClassAttr (LoadError) where should I put the file ClassAttr.rb? I put it inside ci_reporter\lib\ci\reporter but the script was unable to find the file. This is my test script: require 'watir' require 'ci/reporter/rake/test_unit_loader.rb' class TC_TEST_suite Test::Unit::TestCase def test_a_search test_site = http://www.google.com; browser = Watir::Browser.new browser.goto test_site browser.text_field(:name, q).set pickaxe browser.button(:name, btnG).click end end is this correct? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: customize xml generated by ci_reports
Thanks! I have it all up and running and its perfect! I had to rework my xml stylesheet but it was totally worth it. :) -Dylan On Jul 20, 11:12 pm, Tony ynot...@gmail.com wrote: Hi Dylan, Ooops sorry missed that... Basically this class just gives some short cut methods to access the class variables from ReportManager. Code in file ClassAttr.rb class Class def class_attr_reader(*symbols) symbols.each do |symbol| self.class.send(:define_method, symbol) do class_variable_get(@@#{symbol}) end end end def class_attr_writer(*symbols) symbols.each do |symbol| self.class.send(:define_method, #{symbol}=) do |value| class_variable_set(@@#{symbol}, value) end end end def class_attr_accessor(*symbols) class_attr_reader(*symbols) class_attr_writer(*symbols) end end Let me know if you run into any other issues - :) Thanks, Tony --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: customize xml generated by ci_reports
I edited it a little to fit my needs, thought I'd post it: http://pastie.org/554062 I added a passed value to the tests tag so I can easily check if the entire suite passed/failed, along with a time value so I know when the test was run. Thanks again, Tony! -Dylan On Jul 21, 11:35 am, Dylan mej...@gmail.com wrote: Thanks! I have it all up and running and its perfect! I had to rework my xml stylesheet but it was totally worth it. :) -Dylan On Jul 20, 11:12 pm, Tony ynot...@gmail.com wrote: Hi Dylan, Ooops sorry missed that... Basically this class just gives some short cut methods to access the class variables from ReportManager. Code in file ClassAttr.rb class Class def class_attr_reader(*symbols) symbols.each do |symbol| self.class.send(:define_method, symbol) do class_variable_get(@@#{symbol}) end end end def class_attr_writer(*symbols) symbols.each do |symbol| self.class.send(:define_method, #{symbol}=) do |value| class_variable_set(@@#{symbol}, value) end end end def class_attr_accessor(*symbols) class_attr_reader(*symbols) class_attr_writer(*symbols) end end Let me know if you run into any other issues - :) Thanks, Tony --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: customize xml generated by ci_reports
Thanks Tony! I have tried using your file and I'm receiving this error: custom_require.rb:31:in 'gem_original_require': no such file to load -- ClassAttr (LoadError) The error occurs on the line with require 'ClassAttr'. Am I missing some file? Thanks again, I appreciate the help! -Dylan On Jul 17, 4:53 am, Tony ynot...@gmail.com wrote: Hi Dylan, I had modified the code .. and am not sure where to copy and paste it ... Iam including the whole source code for the modified ci reporter - To use this remove the require for ci_reporter and require the modified file. The usage remains the same set the env variable ENV['CI_REPORTS'] = the folder where the reports need to be stored. The file also changes the report file slightly to include multiple test classes that were run. require 'delegate' require 'stringio' require 'fileutils' require 'test/unit' require 'test/unit/ui/console/testrunner' require 'ClassAttr' module YNOT module YNOTE class OutputCapture DelegateClass(IO) # Start capturing IO, using the given block to assign self to the proper IO global. def initialize(io, assign) super @delegate_io = io @captured_io = StringIO.new @assign_block = assign @assign_block.call self end # Finalize the capture and reset to the original IO object. def finish @assign_block.call @delegate_io @captured_io.string end # setup tee methods %w( print printf putc puts write).each do |m| module_eval(-EOS, __FILE__, __LINE__) def #{m}(*args, block) @delegate_io.send(:#{m}, *args, block) @captured_io.send(:#{m}, *args, block) end EOS end end # Basic structure representing the running of a test suite. Used to time tests and store results. class TestSuite Struct.new (:name, :tests, :time, :failures, :errors, :assertions, :passed) attr_accessor :testcases attr_accessor :stdout, :stderr def initialize(name) super(name.to_s) # RSpec passes a description object instead of a string @testcases = [] end # Starts timing the test suite. def start @start = Time.now unless ENV['CI_CAPTURE'] == off @capture_out = OutputCapture.new($stdout) {|io| $stdout = io } @capture_err = OutputCapture.new($stderr) {|io| $stderr = io } end end # Finishes timing the test suite. def finish self.tests = testcases.size self.time = Time.now - @start #self.failures = testcases.inject(0) {|sum,tc| sum += tc.failures.select{|f| f.failure? }.size } self.failures = 0 testcases.each { |tc| self.failures += 1 if tc.failure? } self.errors = testcases.inject(0) {|sum,tc| sum += tc.failures.select{|f| f.error? }.size } self.passed =0 testcases.each { |tc| self.passed += 1 if !(tc.failure? || tc.error?) } #puts PASSED WAS - #{self.passed} self.stdout = @capture_out.finish if @capture_out self.stderr = @capture_err.finish if @capture_err end # Creates the xml builder instance used to create the report xml document. def create_builder require 'rubygems' gem 'builder' require 'builder' # :escape_attrs is obsolete in a newer version, but should do no harm Builder::XmlMarkup.new(:indent = 2, :escape_attrs = true) end # Creates an xml string containing the test suite results. def to_xml builder = create_builder # more recent version of Builder doesn't need the escaping def builder.trunc!(txt) txt.sub(/\n.*/m, '...') end #builder.instruct! attrs = {} each_pair {|k,v| attrs[k] = builder.trunc!(v.to_s) unless v.nil? || v.to_s.empty? } builder.testsuite(attrs) do @testcases.each do |tc| tc.to_xml(builder) end builder.tag! system-out do builder.cdata! self.stdout end builder.tag! system-err do builder.cdata! self.stderr end end end end class TestCase Struct.new(:name, :time, :assertions) attr_accessor :failures def initialize(*args) super @failures = [] end # Starts timing the test. def start @start = Time.now end # Finishes timing the test. def finish #self.time = Time.now - @start self.time = (Time.now - @start).to_i # roundoff the time to an integer end # Returns non-nil if the test failed. def failure? !failures.empty? failures.detect {|f| f.failure? } end # Returns non-nil if the test
[wtr-general] Re: customize xml generated by ci_reports
Hi there! This is something I've been looking for for a while, but unfortunately i can't seem to get your code working. I had to replace YNOT::YNOTE::TestUnitFailure with Test::Unit::Failure because it was not recognizing your code, and it's added the passed' attribute correctly, but it is always set to 1, even if the suite fails. Also, I still get multiple xml files created. Could you give me an example of how you call it that only results in one file? Thanks! -Dylan On Jul 15, 11:50 pm, Tony ynot...@gmail.com wrote: Hi Marlon, Have modified the ci_reporter to include passed/failed/error in ci_reporter. Also have modified the code to create one xml file instead of multiple files when you try to run testcases present in different classes. Modify the TestSuite and TestCase present in Ci_reporter -- (ci_reporter\lib\ci\reporter\test_suite.rb) # Basic structure representing the running of a test suite. Used to time tests and store results. class TestSuite Struct.new (:name, :tests, :time, :failures, :errors, :assertions, :passed) attr_accessor :testcases attr_accessor :stdout, :stderr def initialize(name) super(name.to_s) # RSpec passes a description object instead of a string @testcases = [] end # Starts timing the test suite. def start @start = Time.now unless ENV['CI_CAPTURE'] == off @capture_out = OutputCapture.new($stdout) {|io| $stdout = io } @capture_err = OutputCapture.new($stderr) {|io| $stderr = io } end end # Finishes timing the test suite. def finish self.tests = testcases.size self.time = Time.now - @start #self.failures = testcases.inject(0) {|sum,tc| sum += tc.failures.select{|f| f.failure? }.size } self.failures = 0 testcases.each { |tc| self.failures += 1 if tc.failure? } self.errors = testcases.inject(0) {|sum,tc| sum += tc.failures.select{|f| f.error? }.size } self.passed =0 testcases.each { |tc| self.passed += 1 if !(tc.failure? || tc.error?) } #puts PASSED WAS - #{self.passed} self.stdout = @capture_out.finish if @capture_out self.stderr = @capture_err.finish if @capture_err end # Creates the xml builder instance used to create the report xml document. def create_builder require 'rubygems' gem 'builder' require 'builder' # :escape_attrs is obsolete in a newer version, but should do no harm Builder::XmlMarkup.new(:indent = 2, :escape_attrs = true) end # Creates an xml string containing the test suite results. def to_xml builder = create_builder # more recent version of Builder doesn't need the escaping def builder.trunc!(txt) txt.sub(/\n.*/m, '...') end #builder.instruct! attrs = {} each_pair {|k,v| attrs[k] = builder.trunc!(v.to_s) unless v.nil? || v.to_s.empty? } builder.testsuite(attrs) do @testcases.each do |tc| tc.to_xml(builder) end builder.tag! system-out do builder.cdata! self.stdout end builder.tag! system-err do builder.cdata! self.stderr end end end end class TestCase Struct.new(:name, :time, :assertions) attr_accessor :failures def initialize(*args) super @failures = [] end # Starts timing the test. def start @start = Time.now end # Finishes timing the test. def finish #self.time = Time.now - @start self.time = (Time.now - @start).to_i # roundoff the time to an integer end # Returns non-nil if the test failed. def failure? !failures.empty? failures.detect {|f| f.failure? } end # Returns non-nil if the test had an error. def error? !failures.empty? failures.detect {|f| f.error? } end # Writes xml representing the test result to the provided builder. def to_xml(builder) attrs = {} each_pair {|k,v| attrs[k] = builder.trunc!(v.to_s) unless v.nil? || v.to_s.empty?} builder.testcase(attrs) do failures.each do |failure| # - This is where the type of failure is checked .. error or failure if failure.kind_of?(YNOT::YNOTE::TestUnitFailure) builder.failure(:type = builder.trunc! (failure.name), :message = builder.trunc!(failure.message)) do builder.text!(failure.message + (#{failure.name}) \n) builder.text!(failure.location) end else builder.error(:type = builder.trunc! (failure.name), :message = builder.trunc
[wtr-general] Re: Java Script pop-ups handling in WATIR
Yeah, I had this exact problem and I got it working when I down-graded to 1.8.6-26 (http://rubyforge.org/frs/download.php/29263/ ruby186-26.exe) Here's the code I used to always check for a popup anywhere in my script: #Function to Close Javascript Popups When they Occur def jsClicker( button=OK, waitTime=0) loop do begin hwnd = $win.enabled_popup(waitTime) if (hwnd) # yes there is a popup w = WinClicker.new w.clickWindowsButton_hwnd( hwnd, #{button} ) w=nil $popup = true end rescue end end end def popup_check(results) if($popup) $popup = false return Javascript Popup occurred during test else return Javascript Popup did not occur during test end end I use that global variable to keep track of them when they showed up and automatically click OK, and called popup_check() at the end of every test so I could pass/fail it based on whether or not I expected a popup. I created a thread at the beginning of the program that just went off and did its thing: $sc = Thread.new{jsClicker(OK,0)} $popup = false Then you just need to make sure all your clicks that you think might have a popup are click_no_waits. Also, I found that something I was defining as a button and using click on, I had to redefine as an image (it was an image, but I could call it a button and click would work) for click_no_wait to fire correctly on it. If you want to not have it run continuously, then take out the loop in jsClicker() and just call it with a wait time of a few seconds after your click_no_wait call. Hope this helps! -Dylan On Jul 16, 8:19 am, Smruti Ranjan Kar smrutiranjan@gmail.com wrote: Hi Charley, I'm using ruby186-27_rc2 C:\Documents and Settings\userruby -v ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] On Thu, Jul 16, 2009 at 7:58 PM, Charley Baker charley.ba...@gmail.comwrote: Try click! instead of click_no_wait, which specific version of Ruby are you using, the latest one click 1.8.6rc2? What does ruby -v give you? There is a problem with that installer if that's the one you used where command line arguments don't get quoted correctly. Charley Baker blog:http://blog.charleybaker.org/ Lead Developer, Watir,http://wtr.rubyforge.org QA Architect, Gap Inc Direct On Thu, Jul 16, 2009 at 10:20 AM, Smruti smrutiranjan@gmail.comwrote: Hello, I have been trying to automate a requirement, that is like - When I click on a link on the page, a popup should open up - I have to verify if the pop up opened and if the text in the pop up is correct - Click 'OK' on the pop up and move on. I have tried the suggestions at http://wiki.openqa.org/display/WTR/JavaScript+Pop+Ups , but they did not work. I tried with AutoIt as well as watir/contrib/ enabled_popup. My observations are 1. If I click the button using, 'click', the pop up remains open and the script does not move forward. So, the script written after do not get executed. But if I run from IRB it works fine. 2. If I click the button using 'click_no_wait', the pop up gets closed immediately and the following scripts do not find the pop up. XP SP2 Ruby 1.8 Watir 1.6.2 IE Please, suggest. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: How do I stop getting emails from Watir General?
Edit my membership on the right hand side, I believe. -Dylan On Jul 16, 9:42 am, Geniene Martorell martore...@hotmail.com wrote: I used to want the emails, now I don't. I set my subscription to No Email but I am still getting emails. I don't want to unsubscribe to stop the emails - any ideas? Thanks! EMAILING FOR THE GREATER GOOD Join me --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Watir + Cruise Control
Thanks everybody! I think I have a handle on how I'm going to set this up now. I really appreciate the help! -Dylan On Jul 12, 10:22 pm, pallavi shashidhar pals.sha...@gmail.com wrote: Hi there, We have used cruise control to run our test suites. We have structured our test scripts with certain conventions. 1) We have an ERP suite which has different watir scripts for different projects. each set is developed and maintained by different testers. 2) All of us follow this. - we have a folder called *regression* where all our test case ruby files are stored in there. Each testcase file is named as *test_*filename.rb. Each test case class name starts with PROJECTNAME_TC_CLASSNAME. We use TEST::UNIT framework. Using Watir::TestCase did not solve the problem of determining the order of execution. So we instead used PROJECTNAME in the class name so that all those testcases under that project will be executed as one set after which other scripts of another PROJECT is run. Does not matter which PROJECT is run first as long as the whole set is run. 3) Along with regression as a folder, we also have *common* as another folder where our common files like utils and constants are placed there 4) On cruise control, on top of all the PROJECT folders, we have a *setup.rb * file which is a simple ruby file with one line - which does the foll: require' all those testcases under regression folder starting with test_* this will get all the scripts grouped by PROJECTNAME class. 5) In Cruise control build file, have set up the ant target as run.watir which runs *setup.rb* Before we started using PROJECTNAME in the class name, all the testcase scripts in different projects were getting jumbled up and hence the name. 6) We are using ci_reporter for results and publising the results by sending a mail (emailtarget is set in cruise control config.xml) and we give the CC dashboard link in the mail to view the results. Regards, Pallavi On Mon, Jul 13, 2009 at 5:57 AM, Zhimin zhiminz...@gmail.com wrote: http://www.itest2.com/articles/2009/03/22/setup-continuous-build-serv... It uses ci_reporter as well. Zhimin http://www.itest2.com On Jul 10, 3:58 am, Dylan mej...@gmail.com wrote: Does anyone know of a good tutorial/step-by-step instructions for how to integrate watir/ruby into a cruise control build cycle. I have 1 xml output file (from ci_reporter) and I want my script to run after the build and then integrate the xml results into the cruise control output. Thanks! -Dylan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: How to check the load time of an page?
If I'm understanding you right, you want your test to never take more than 20 seconds, and if the page isn't loaded by then put that in the log? If so, you would need something like click_no_wait for goto (or you can justwrite a tiny html file that just has a link to the page and call click_no_wait on that). I'm not sure how hard that would be to extend watir to do. Then you can run a while loop (this is pseudocode): start = Time.now while Time.now - start = 20 if ($ie.text.include? Some text on the page) Write to log file that page loaded in Time.now-start seconds end end Write to log file that page did not load within 20 seconds Alternatively, you can use a Timeout, which neatly sidesteps the freeze while a page loads (actual code): require 'watir' require 'timeout' mylog= File.new( Time.now.strftime(%d-%b-%y) + .csv,'a') $ie = Watir::IE.new ltitle = start = Time.now begin Timeout::timeout(20) do $ie.goto(http://www.localhost;) ltitle = $ie.title if $ie.text.include?(Home) stop = Time.now mylog.puts Time.now.strftime(%I:%M:%S%p).to_s + , + Page Loaded Successfully + , + (stop-start).to_s else mylog.puts Time.now.strftime(%I:%M:%S%p).to_s + , + Failed to load the URL + , + ltitle.to_s end end rescue Timeout::Error mylog.puts Time.now.strftime(%I:%M:%S%p).to_s + , + Taking more time to respond + ,20 rescue = e mylog.puts Time.now.strftime(%I:%M:%S%p).to_s + , + Failed to load the URL + , + ltitle.to_s + , + e.to_s end $ie.close Hope that helps! On Jul 5, 11:54 pm, Soori sure...@gmail.com wrote: Hi All, I would like to monitor the load time of an web page once in a 15 mins for 2hrs, i should log in a file if the load time of that web page exceeds 20secs, I tried with following code, but sometimes my page takes more than 100 secs to load, am getting that message after that 100 sec, It would be better if i get the entry on log file immediately after exceeding the 20 secs.Please help me in this front. Thanks in advance for ur help. require 'watir' mylog= File.new( Time.now.strftime(%d-%b-%y) + .csv,'a') $ie=IE.new begin startTime=Time.now $ie.goto('http://localhost/') x=Time.now-startTime ltitle=$ie.title if x 20 mylog.puts Time.now.strftime(%I:%M:%S%p).to_s + , + Taking more time to respond + , + x.to_s elsif $ie.text.include?(Home) mylog.puts Time.now.strftime(%I:%M:%S%p).to_s + , + Page Loaded Successfully + , + x.to_s else mylog.puts Time.now.strftime(%I:%M:%S%p).to_s + , + Failed to load the URL + , + ltitle.to_s end rescue = e mylog.puts Time.now.strftime(%I:%M:%S%p).to_s + , + Failed to load the URL + , + ltitle.to_s + , + e.to_s end /Soori --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Watir + Cruise Control
Thank you for the response. Unfortunately, we are already pretty well entrenched with Cruise Control here and aren't really looking to change to a new system. -Dylan On Jul 9, 5:03 pm, marekj marekj@gmail.com wrote: I use Hudson. has a ruby and rake plugin. I use custom workspace for all jobs. The test code does not need to be checked out ever time. jobs triggered by rake tasks calling ci_reporter as dependency (the Test::Unit version) and task body just calls TestRunner.run TestCaseName TestCases are Watir::TestCase classes but each method is a collection of examples using Rspec matchers instead of assertions Hudson post-job collects the xml from test/results/*.xml generated b ci_reporter Ease and Joy (for now) my next step is to actually convert to Rspec ExampleGroups instead of TestCase And then covert ci_reporter to use rspec instead of testunit, should be painless but takes time I have about 6 hours of tests (all the slow ones included) about 20 jobs. And few jobs that are triggers I juse buildWithParameters options so I can pass some ENV variables into Hudson that's about it marekj Watirloo: Semantic Page Objects in UseCaseshttp://github.com/marekj/watirloo/ On Thu, Jul 9, 2009 at 12:58 PM, Dylanmej...@gmail.com wrote: Does anyone know of a good tutorial/step-by-step instructions for how to integrate watir/ruby into a cruise control build cycle. I have 1 xml output file (from ci_reporter) and I want my script to run after the build and then integrate the xml results into the cruise control output. Thanks! -Dylan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Watir + Cruise Control
Does anyone know of a good tutorial/step-by-step instructions for how to integrate watir/ruby into a cruise control build cycle. I have 1 xml output file (from ci_reporter) and I want my script to run after the build and then integrate the xml results into the cruise control output. Thanks! -Dylan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Dealing with font, table and triggering Javascript
I have version REXML 3.1.7.2 installed. I have managed to find a workaround now (Adding the font tag to watir) that probably works better than an xpath would, in fact, but from what I've seen very few people have gotten xpaths to work with watir (at least the element_by_xpath part) in the first place. It might be helpful if someone who does have them working could give a mini- tutorial or something. I would do it myself, but obviously I am not one of those people who knows what they're doing. :) Xpaths can be very powerful and it would be nice to at least have the option. Also, for anyone who was in a similar boat as me, I had a hard time figuring out where to put the class code Željko Filipin was so awesome to post on his blog, and through trial and error it apparently goes in the NonControlElement.rb file. Probably duh for most of you, but if there are any other watir/ruby noobs out there, hope that helps. -Dylan On Jul 8, 1:14 am, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Tue, Jul 7, 2009 at 7:52 PM, Dylan mej...@gmail.com wrote: I've even copied the exact html and ruby code given in the What to do for elements not having class in Watir? section, and I still get nil returned. I think you have to have newer version of rexml (3.1.6) than the one shipped with some versions of ruby. http://zeljkofilipin.com/2007/10/18/how-do-i-get-rexml-version-number/ Željko --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Dealing with font, table and triggering Javascript
Well, I finally figured out how to add font to Watir, as you suggested, and that seems to work great. Thank you so much! -Dylan On Jul 3, 12:42 am, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Fri, Jul 3, 2009 at 12:54 AM, Dylan mej...@gmail.com wrote: font class=link title=Click Here onclick=javaScriptCommand ();Click Here/font Try this: browser.element_by_xpath(//fo...@title='Click Here']/).click More information: http://wiki.openqa.org/display/WTR/XPath And you can always extend Watir to make this possible: browser.font(:title, Click Here).click http://zeljkofilipin.com/2007/07/04/extend-watir/ Željko --http://watirpodcast.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Dealing with font, table and triggering Javascript
Hey there! I have a problem I've been banging my head against my desk on for a while now, so here's hoping someone can help. I'm trying to click on an element and I can't figure out how. I can use frame and div to get down to the place on the page where I want to click and end up like this: $win.frame().frame().div().table()[4][2] the html inside table[4][2] is: font class=link title=Click Here onclick=javaScriptCommand ();Click Here/font and I'm trying to trigger the onclick event. I've tried .click, fire_event(onclick), fire_event(onmouseup) on the td element, as well as the tr and table elements, and none of them work. When I use .flash it flashes over the correct area, so its just a matter of not triggering the onclick event for the right element. I've also tried to grab the actual font element but I can't get Watir to find it. Can anyone help me? If I can get this to work I'll never be more excited to see a button click. :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Dealing with font, table and triggering Javascript
Hey there! I have a problem I've been banging my head against my desk on for a while now, so here's hoping someone can help. I'm trying to click on an element and I can't figure out how. I can use frame and div to get down to the place on the page where I want to click and end up like this: $win.frame().frame().div().table()[4][2] the html inside table[4][2] is: font class=link title=Click Here onclick=javaScriptCommand ();Click Here/font and I'm trying to trigger the onclick event. I've tried .click, fire_event(onclick), fire_event(onmouseup) on the td element, as well as the tr and table elements, and none of them work. When I use .flash it flashes over the correct area, so its just a matter of not triggering the onclick event for the right element. I've also tried to grab the actual font element but I can't get Watir to find it. Can anyone help me? If I can get this to work I'll never be more excited to see a button click. :) Thanks in advance! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---