[wtr-general] Re: watir-webdriver survey for adding items such as: alert_box, scroll_to, and in_viewable_area?
I vote for leaving watir-webdriver simple. If people want these features they can just use qa_robusta, or monkey patch watir-webdriver themselves. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Watir and Ajax requests
In my webapp I have a simple textfield. To this textfield I have a jQuery function which will be always executed on every keyup. With this function there is an Ajax request assigned which loads every time the result of the SQL-Query. My code is equivalent to the code of RailsCasts (www.railscasts.com/episodes/240-search-sort-paginate-with- ajax). Now I'm testing my webapp with Selenium. With this line of code browser.text_field(:id = 'textfield').set(Search text) the text will be written and the content will be changed. After it should click on a link which is placed on the dynamic content with this code browser.a(:id = link).click. The problem now is that the click event won't be executed. Has somebody an idea what the problem could be? Or maybe an example with Watir and Ajax? Thank you and regards shub -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Re: Trying to use SafariWatir and receiving an error when keying value into a text_field
On Tue, Oct 11, 2011 at 10:54 PM, Joe Fl joeflec...@gmail.com wrote: Why is it like that and should I expect more like this? Each watir gem (watir, watir-webdriver, safariwatir...) was developed in isolation, meaning there is no code sharing. That means that the API is not 100% the same. We have watirspec project that will probably one day give you precise information how each gem conforms to the official Watir API*. Željko -- * The official Watir API does not exist yet. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Watir and Ajax requests
On Wed, Oct 12, 2011 at 7:38 AM, User silvan.hub...@gmail.com wrote: After it should click on a link which is placed on the dynamic content with this code browser.a(:id = link).click. The problem now is that the click event won't be executed. I did not understand what is the problem here. When you click a link nothing happens? And what should happen? Could you create a sample page and send us the URL? Željko -- watir.com - community manager watir.com/book - author watirpodcast.com - host -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Watir and Ajax requests
What do you expect when clicking that link and how do you know that it didn't get clicked? Jarmo Pertman - IT does really matter - http://itreallymatters.net On Oct 12, 8:38 am, User silvan.hub...@gmail.com wrote: In my webapp I have a simple textfield. To this textfield I have a jQuery function which will be always executed on every keyup. With this function there is an Ajax request assigned which loads every time the result of the SQL-Query. My code is equivalent to the code of RailsCasts (www.railscasts.com/episodes/240-search-sort-paginate-with- ajax). Now I'm testing my webapp with Selenium. With this line of code browser.text_field(:id = 'textfield').set(Search text) the text will be written and the content will be changed. After it should click on a link which is placed on the dynamic content with this code browser.a(:id = link).click. The problem now is that the click event won't be executed. Has somebody an idea what the problem could be? Or maybe an example with Watir and Ajax? Thank you and regards shub -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Retrieving checkbox values
Hi All, I am trying to get the number of checkboxes within a window. I want to get the value of each one without knowing which one I will be using. html fieldset class=theme-options input id=simple_discussion_resource_category_ids_ type=hidden value= name=simple_discussion[resource_category_ids][] div class=add-themes div class=label-like ul class=lists li input id=simple_discussion_resource_category_90 class=checkbox type=checkbox value=90 name=simple_discussion[resource_category_ids][] label for=simple_discussion_resource_category_90Ambulatory/ Outpatient Care/label /li li li li li li li li /ul ul class=lists I would like to get the number of li and then loop through and get the value which I need for later in my script. One of many attempts to get this: themeint = themeNum = $browser.div(:class,'add- themes').ul(:class,'lists').lists.length $browser.div(:class,'add-themes').lis.each do|themeint| checkboxName = $browser.div(:class,'add- themes').ul(:class,'lists').li(:class,'checkbox').value puts checkboxName end Any help is always appreciated and thank you so much for the help ahead of time. Joe -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Retrieving checkbox values
On Wed, Oct 12, 2011 at 3:32 PM, Joe Fl joeflec...@gmail.com wrote: I am trying to get the number of checkboxes within a window. browser.checkboxes.size returns: 1 I want to get the value of each one without knowing which one I will be using. browser.checkboxes.each {|checkbox| puts checkbox.value} output: 90 I would like to get the number of li b.lis.size returns: 8 and then loop through and get the value which I need for later in my script. b.lis.each {|li| puts li.text.inspect} returns: Ambulatory/ Outpatient Care Željko -- watir.com - community manager watir.com/book - author watirpodcast.com - host -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Element not found in cache error in Frames, Watir-webdriver
I'm seeing an annoying issue that I suspect has to do with objects inside page frames and Selenium and Watir-Webdriver. I brought up part of it already in this post: https://groups.google.com/d/topic/watir-general/gIgtHbFxfbw/discussion Here's a similar issue: If I reference some text on a page like this: @browser.frame(:index=0).table(:class=itemSummary).td(:class=shorttext, :index=0).text ...it will work fine. I get the text I need, just as expected. However, that's a nasty long bit of code and I don't want to have to use that string every time I need that page object. So I defined a method. def site_id @browser.frame(:index=0).table(:class=itemSummary).td(:class=shorttext, :index=0).text end Sadly, when I call the method in my scripts, I get... *Selenium::WebDriver::Error::ObsoleteElementError: Element not found in the cache* * * There's no way it's an obsolete element, because the class containing that method gets instantiated *immediately* before the method is called. Is this a known issue? Any ideas for a way around this that will allow me to continue to use my method instead of the explicit call to the object? -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Firefox not able to open through Watir
hi, my code is require 'rubygems' require 'watir' require 'watir-webdriver' require 'watir/browser' include Watir Watir::Browser.default = 'ie' $ie = Watir::Browser.new $ie.goto(www.google.com) it is working fine while opening for IE but when i change to 'ff' or 'firefox' it is not opening at all. i have gem list as follows: C:\Suvogem list *** LOCAL GEMS *** activesupport (3.1.1) builder (3.0.0) child-process-manager (0.0.3) childprocess (0.2.2) commonwatir (2.0.2) fattr (2.2.0) ffi (1.0.9) firewatir (1.9.4) flexmock (0.9.0) hoe (2.12.3) json_pure (1.6.1) minitest (2.6.1) multi_json (1.0.3) nokogiri (1.4.0 x86-mswin32) rake (0.9.2) rautomation (0.6.3) rdiscount (1.6.8) rubygems-update (1.8.10) rubyzip (0.9.4) s4t-utils (1.0.4) selenium-webdriver (2.7.0) session (3.1.0) user-choices (1.1.6.1) watir (2.0.2) watir-webdriver (0.3.4) win32-api (1.4.8) win32-process (0.6.5) windows-api (0.4.0) windows-pr (1.2.1) xml-simple (1.1.0) please help thanks -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Firefox not able to open through Watir
Why do you have watir and watir-webdriver both? I will try with the following: require 'rubygems' require 'watir-webdriver' browser = Watir::Browser.new :firefox On 12 October 2011 16:56, Babu suvodasgu...@gmail.com wrote: hi, my code is require 'rubygems' require 'watir' require 'watir-webdriver' require 'watir/browser' include Watir Watir::Browser.default = 'ie' $ie = Watir::Browser.new $ie.goto(www.google.com) it is working fine while opening for IE but when i change to 'ff' or 'firefox' it is not opening at all. i have gem list as follows: C:\Suvogem list *** LOCAL GEMS *** activesupport (3.1.1) builder (3.0.0) child-process-manager (0.0.3) childprocess (0.2.2) commonwatir (2.0.2) fattr (2.2.0) ffi (1.0.9) firewatir (1.9.4) flexmock (0.9.0) hoe (2.12.3) json_pure (1.6.1) minitest (2.6.1) multi_json (1.0.3) nokogiri (1.4.0 x86-mswin32) rake (0.9.2) rautomation (0.6.3) rdiscount (1.6.8) rubygems-update (1.8.10) rubyzip (0.9.4) s4t-utils (1.0.4) selenium-webdriver (2.7.0) session (3.1.0) user-choices (1.1.6.1) watir (2.0.2) watir-webdriver (0.3.4) win32-api (1.4.8) win32-process (0.6.5) windows-api (0.4.0) windows-pr (1.2.1) xml-simple (1.1.0) please help thanks -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Regards, Rahul Sharma Ph:+44 7800 736851 -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Retrieving checkbox values
Hi Željko, Thank you for getting me started. I have developed the following code but I an still falling short of getting the value property. lists = $browser.div(:class,'add-themes').lis lists.each do |li| puts chckbx = li.text $browser.div(:class,'add-themes').label(:text,chckbx).click end here is what I have for checkboxes checkboxes = $browser.div(:class,'add-themes').checkbox checkboxes.each do |checkbox| puts chckbxValue = checkbox.value end It errors out. undefined method `each' for #Watir::CheckBox:0x10d530f30 from /Users/josephfleck/.rvm/gems/ree-1.8.7-2010.02/gems/watir-webdriver-0.3.4/lib/watir-webdriver/elements/element.rb:295:in `method_missing' from (irb):99 from /Users/josephfleck/.rvm/gems/ree-1.8.7-2010.02/gems/selenium-webdriver-2.7.0/lib/selenium/webdriver/firefox/binary.rb:48 I can click on the label for the checkbox but I can't seem to retrieve those values. On Wed, Oct 12, 2011 at 9:42 AM, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Wed, Oct 12, 2011 at 3:32 PM, Joe Fl joeflec...@gmail.com wrote: I am trying to get the number of checkboxes within a window. browser.checkboxes.size returns: 1 I want to get the value of each one without knowing which one I will be using. browser.checkboxes.each {|checkbox| puts checkbox.value} output: 90 I would like to get the number of li b.lis.size returns: 8 and then loop through and get the value which I need for later in my script. b.lis.each {|li| puts li.text.inspect} returns: Ambulatory/ Outpatient Care Željko -- watir.com - community manager watir.com/book - author watirpodcast.com - host -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Watir and Ajax requests
I see we have this same exact question over on StackOverflow.. http://stackoverflow.com/questions/7722712/watir-and-ajax-requests I vote we deal with the answer over there as that venue is better about being able to format code samples, edit questions and answers, etc. No sense duplicating the effort to assist user in two places On Oct 12, 3:55 am, Jarmo Pertman jarm...@gmail.com wrote: What do you expect when clicking that link and how do you know that it didn't get clicked? Jarmo Pertman - IT does really matter -http://itreallymatters.net On Oct 12, 8:38 am, User silvan.hub...@gmail.com wrote: In my webapp I have a simple textfield. To this textfield I have a jQuery function which will be always executed on every keyup. With this function there is an Ajax request assigned which loads every time the result of the SQL-Query. My code is equivalent to the code of RailsCasts (www.railscasts.com/episodes/240-search-sort-paginate-with- ajax). Now I'm testing my webapp with Selenium. With this line of code browser.text_field(:id = 'textfield').set(Search text) the text will be written and the content will be changed. After it should click on a link which is placed on the dynamic content with this code browser.a(:id = link).click. The problem now is that the click event won't be executed. Has somebody an idea what the problem could be? Or maybe an example with Watir and Ajax? Thank you and regards shub -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Firefox not able to open through Watir
i am getting this error C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.7.0/lib/ selenium/webdrive r/firefox/binary.rb:116:in `path': Could not find Firefox binary (os=windows). M ake sure Firefox is installed or set the path manually with Selenium::WebDriver: :Firefox::Binary.path= (Selenium::WebDriver::Error::WebDriverError) from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium- webdriver-2.7.0/lib/sele nium/webdriver/firefox/binary.rb:49:in `execute' from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium- webdriver-2.7.0/lib/sele nium/webdriver/firefox/binary.rb:30:in `start_with' from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium- webdriver-2.7.0/lib/sele nium/webdriver/firefox/launcher.rb:68:in `start_silent_and_wait' from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium- webdriver-2.7.0/lib/sele nium/webdriver/firefox/launcher.rb:35:in `launch' from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium- webdriver-2.7.0/lib/sele nium/webdriver/firefox/socket_lock.rb:20:in `locked' from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium- webdriver-2.7.0/lib/sele nium/webdriver/firefox/launcher.rb:32:in `launch' from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium- webdriver-2.7.0/lib/sele nium/webdriver/firefox/bridge.rb:19:in `initialize' from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium- webdriver-2.7.0/lib/sele nium/webdriver/common/driver.rb:29:in `new' from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium- webdriver-2.7.0/lib/sele nium/webdriver/common/driver.rb:29:in `for' from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium- webdriver-2.7.0/lib/sele nium/webdriver.rb:81:in `for' from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.4/ lib/watir-w ebdriver/browser.rb:35:in `initialize' from sample.rb:12:in `new' from sample.rb:12 On Oct 12, 12:00 pm, Rahul Sharma rahulsharma@gmail.com wrote: Why do you have watir and watir-webdriver both? I will try with the following: require 'rubygems' require 'watir-webdriver' browser = Watir::Browser.new :firefox On 12 October 2011 16:56, Babu suvodasgu...@gmail.com wrote: hi, my code is require 'rubygems' require 'watir' require 'watir-webdriver' require 'watir/browser' include Watir Watir::Browser.default = 'ie' $ie = Watir::Browser.new $ie.goto(www.google.com) it is working fine while opening for IE but when i change to 'ff' or 'firefox' it is not opening at all. i have gem list as follows: C:\Suvogem list *** LOCAL GEMS *** activesupport (3.1.1) builder (3.0.0) child-process-manager (0.0.3) childprocess (0.2.2) commonwatir (2.0.2) fattr (2.2.0) ffi (1.0.9) firewatir (1.9.4) flexmock (0.9.0) hoe (2.12.3) json_pure (1.6.1) minitest (2.6.1) multi_json (1.0.3) nokogiri (1.4.0 x86-mswin32) rake (0.9.2) rautomation (0.6.3) rdiscount (1.6.8) rubygems-update (1.8.10) rubyzip (0.9.4) s4t-utils (1.0.4) selenium-webdriver (2.7.0) session (3.1.0) user-choices (1.1.6.1) watir (2.0.2) watir-webdriver (0.3.4) win32-api (1.4.8) win32-process (0.6.5) windows-api (0.4.0) windows-pr (1.2.1) xml-simple (1.1.0) please help thanks -- Before posting, please readhttp://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Regards, Rahul Sharma Ph:+44 7800 736851- Hide quoted text - - Show quoted text - -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Firefox not able to open through Watir
i got it open. but not able to navigate to google? On Oct 12, 12:00 pm, Rahul Sharma rahulsharma@gmail.com wrote: Why do you have watir and watir-webdriver both? I will try with the following: require 'rubygems' require 'watir-webdriver' browser = Watir::Browser.new :firefox On 12 October 2011 16:56, Babu suvodasgu...@gmail.com wrote: hi, my code is require 'rubygems' require 'watir' require 'watir-webdriver' require 'watir/browser' include Watir Watir::Browser.default = 'ie' $ie = Watir::Browser.new $ie.goto(www.google.com) it is working fine while opening for IE but when i change to 'ff' or 'firefox' it is not opening at all. i have gem list as follows: C:\Suvogem list *** LOCAL GEMS *** activesupport (3.1.1) builder (3.0.0) child-process-manager (0.0.3) childprocess (0.2.2) commonwatir (2.0.2) fattr (2.2.0) ffi (1.0.9) firewatir (1.9.4) flexmock (0.9.0) hoe (2.12.3) json_pure (1.6.1) minitest (2.6.1) multi_json (1.0.3) nokogiri (1.4.0 x86-mswin32) rake (0.9.2) rautomation (0.6.3) rdiscount (1.6.8) rubygems-update (1.8.10) rubyzip (0.9.4) s4t-utils (1.0.4) selenium-webdriver (2.7.0) session (3.1.0) user-choices (1.1.6.1) watir (2.0.2) watir-webdriver (0.3.4) win32-api (1.4.8) win32-process (0.6.5) windows-api (0.4.0) windows-pr (1.2.1) xml-simple (1.1.0) please help thanks -- Before posting, please readhttp://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Regards, Rahul Sharma Ph:+44 7800 736851- Hide quoted text - - Show quoted text - -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Firefox not able to open through Watir
able to navigate the diffent site but when i want to get all the text form different HTML tag i need to add require 'watir' which is giving compliation error as C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.4/lib/watir- webdriver/vers ion.rb:2: warning: already initialized constant VERSION C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.4/lib/watir- webdriver/exce ption.rb:8: superclass mismatch for class UnknownObjectException (TypeError) from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:53:in `gem_original_require' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:53:in `require' from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.4/ lib/watir-w ebdriver.rb:7 from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:57:in `gem_original_require' from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:57:in `require' from sample.rb:5 On Oct 12, 12:57 pm, Babu suvodasgu...@gmail.com wrote: i got it open. but not able to navigate to google? On Oct 12, 12:00 pm, Rahul Sharma rahulsharma@gmail.com wrote: Why do you have watir and watir-webdriver both? I will try with the following: require 'rubygems' require 'watir-webdriver' browser = Watir::Browser.new :firefox On 12 October 2011 16:56, Babu suvodasgu...@gmail.com wrote: hi, my code is require 'rubygems' require 'watir' require 'watir-webdriver' require 'watir/browser' include Watir Watir::Browser.default = 'ie' $ie = Watir::Browser.new $ie.goto(www.google.com) it is working fine while opening for IE but when i change to 'ff' or 'firefox' it is not opening at all. i have gem list as follows: C:\Suvogem list *** LOCAL GEMS *** activesupport (3.1.1) builder (3.0.0) child-process-manager (0.0.3) childprocess (0.2.2) commonwatir (2.0.2) fattr (2.2.0) ffi (1.0.9) firewatir (1.9.4) flexmock (0.9.0) hoe (2.12.3) json_pure (1.6.1) minitest (2.6.1) multi_json (1.0.3) nokogiri (1.4.0 x86-mswin32) rake (0.9.2) rautomation (0.6.3) rdiscount (1.6.8) rubygems-update (1.8.10) rubyzip (0.9.4) s4t-utils (1.0.4) selenium-webdriver (2.7.0) session (3.1.0) user-choices (1.1.6.1) watir (2.0.2) watir-webdriver (0.3.4) win32-api (1.4.8) win32-process (0.6.5) windows-api (0.4.0) windows-pr (1.2.1) xml-simple (1.1.0) please help thanks -- Before posting, please readhttp://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Regards, Rahul Sharma Ph:+44 7800 736851- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Firefox not able to open through Watir
On Oct 12, 9:00 am, Rahul Sharma rahulsharma@gmail.com wrote: Why do you have watir and watir-webdriver both? I will try with the following: require 'rubygems' require 'watir-webdriver' browser = Watir::Browser.new :firefox Also why oh why do you have include Watir in there? -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Element not found in cache error in Frames, Watir-webdriver
Oops! Chuck, thanks for the reminder about Page Object. I just discovered the source of the problem was that I had two methods with the same name in this page class. Argh! False alarm. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Re: Retrieving checkbox values
Hi Chuck, Thank you for help. I used the parent. lists = $browser.div(:class,'add-themes').lis numListStr = lists.length lists.each do |li| puts chckbx = li.text davalue = $browser.label(:text, chckbx).parent.checkbox.value puts davalue end I just want a specific section of checkboxes and there are more within the window. Thank you very much this is huge win. Joe On Wed, Oct 12, 2011 at 1:42 PM, Chuck van der Linden sqa...@gmail.comwrote: On Oct 12, 9:11 am, Joe Fleck joeflec...@gmail.com wrote: Hi Željko, Thank you for getting me started. I have developed the following code but I an still falling short of getting the value property. lists = $browser.div(:class,'add-themes').lis lists.each do |li| puts chckbx = li.text $browser.div(:class,'add-themes').label(:text,chckbx).click end here is what I have for checkboxes checkboxes = $browser.div(:class,'add-themes').checkbox checkboxes.each do |checkbox| puts chckbxValue = checkbox.value end It errors out. undefined method `each' for #Watir::CheckBox:0x10d530f30 from /Users/josephfleck/.rvm/gems/ree-1.8.7-2010.02/gems/watir-webdriver-0.3.4/lib/watir-webdriver/elements/element.rb:295:in `method_missing' from (irb):99 from /Users/josephfleck/.rvm/gems/ree-1.8.7-2010.02/gems/selenium-webdriver-2.7.0/lib/selenium/webdriver/firefox/binary.rb:48 I can click on the label for the checkbox but I can't seem to retrieve those values. Your problem is that you are trying to call the .each method on a single checkbox, not a collection of checkboxes. There error is a missing 's' character at the end of this line checkboxes = $browser.div(:class,'add-themes').checkbox That's going to return the first checkbox with that class, not a collection of ALL checkboxes with that class Secondly, it's a stylistic thing mostly I suppose, but I have to ask, why write it this way checkboxes = $browser.div(:class,'add-themes').checkbox checkboxes.each do |checkbox| Instead of just using this $browser.div(:class,'add-themes').checkboxs.each do |checkbox| Also in the inner loop, why do puts chckbxValue = checkbox.value instead of puts checkbox.value The biggest testability problem I see with your code is that your list items have no easy means to identify them, and the checkboxes have no text, but rather a label defined in parallel within the list item. Maybe someone else can find a more elegant means of doing this, but I suspect you may need to make use of the .parent method, using perhaps something along this line davalue = browser.label(:text, Ambulatory/Outpatient Care).parent.checkbox.value That should work if the objective is to get the value for a known label. If you are trying to build up some kind of list of labelsvalues then you could do something similar to this browser.lis.each_with_index do | li, i| puts i puts li.label.text.inspect puts li.checkbox.value end -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Firefox not able to open through Watir
but if i not include watir then how ican get all html tags value from the firefox webpage? On Oct 12, 1:52 pm, Chuck van der Linden sqa...@gmail.com wrote: On Oct 12, 9:00 am, Rahul Sharma rahulsharma@gmail.com wrote: Why do you have watir and watir-webdriver both? I will try with the following: require 'rubygems' require 'watir-webdriver' browser = Watir::Browser.new :firefox Also why oh why do you have include Watir in there? -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: confused with versioning in Watir
Hi! Try not to reply to me directly, but reply to the watir-general list instead :) And what is exactly showing 1.8.7 for you? What would you expect it to show instead? Jarmo On Wed, Oct 12, 2011 at 6:29 PM, Babu suvodasgu...@gmail.com wrote: i got it...now thanks it is showing the 1.8.7 thanks babu On Oct 12, 4:54 am, Jarmo Pertman jarm...@gmail.com wrote: What does $LOAD_PATH tell you: irb(main):005:0 $LOAD_PATH.grep /watir/ = [C:/bin/pik/Ruby-187-p302/lib/ruby/gems/1.8/gems/watir-2.0.2/lib/ watir/win32ole/1.8.7, C:/bin/pik/Ruby-187-p302/lib/ruby/gems/1.8/ gems/commonwat ir-2.0.2/lib, C:/bin/pik/Ruby-187-p302/lib/ruby/gems/1.8/gems/ watir-2.0.2/lib, C:/bin/pik/Ruby-187-p302/lib/ruby/gems/1.8/gems/ firewatir-1.9.4/lib ] This shows me that i have loaded watir-2.0.2. What version of Ruby do you even have? Jarmo Pertman - IT does really matter -http://itreallymatters.net On Oct 12, 3:00 am, Chuck van der Linden sqa...@gmail.com wrote: On Oct 11, 9:40 am, Babu suvodasgu...@gmail.com wrote: if i uninstall ruby then i have to install all the gems again manually since in my office there is firewall issue so i download and install all the gems manually. You could look into using RVM (for linux/mac) or PIK (windows) to manage multiple versions of ruby, and sets of gems, at once. That might provide you with some shortcuts, and I think when you sync/clone a set of gems it's going by what's installed via the gem manager so might let you get rid of any bogus files you are saddled with- Hide quoted text - - Show quoted text - -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Retrieving checkbox values
On Oct 12, 12:09 pm, Joe Fleck joeflec...@gmail.com wrote: Hi Chuck, Thank you for help. I used the parent. lists = $browser.div(:class,'add-themes').lis numListStr = lists.length lists.each do |li| puts chckbx = li.text davalue = $browser.label(:text, chckbx).parent.checkbox.value puts davalue end I just want a specific section of checkboxes and there are more within the window. Thank you very much this is huge win. IMHO you still seem to be doing a few rather round-about things in there. If the structure of the page is a list item, inside which is a label and a checkbox, then when you get the collection of list items, you also have inside each of them the label and the checkbox.. You should not need to get the text from the label, then use that to find the label, the label's parent, and the checkbox that is inside the parent. If you are not going to use them inside the loop, why go to the trouble of creating variables just so you can feed them to puts? This makes for far simpler and easier to read code IMHO The loop then becomes lists.each do |li| puts li.text # or li.label.text if it's important to verify that the label exists. puts li.checkbox.value end Also, unless you need to get the count of how many list items are present, the first three lines could be done simply as: $browser.div(:class,'add-themes').lis.each do |li| -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Firefox not able to open through Watir
On Oct 12, 12:47 pm, Babu suvodasgu...@gmail.com wrote: but if i not include watir then how ican get all html tags value from the firefox webpage? On Oct 12, 1:52 pm, Chuck van der Linden sqa...@gmail.com wrote: Include isn't doing what you think it is. read this: http://wiki.openqa.org/display/WTR/include+Watir If you are using watir-webdriver, it has all the functionality you need, and since many of the methods and objects etc have the same name, it's just going to hopelessly confuse your poor system if you try to use both at the same time inside your scripts. (ok I know that's maybe not technically accurate, but it's an easy way of trying to explain why what he's trying to do is 'a bad thing' ) -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Firefox not able to open through Watir
i was wrong.. i mean to say require 'watir' if i don't use this then i can't get all the HTML tags so f i use require 'rubygems' require 'watir-webdriver' browser = Watir::Browser.new :firefox then can i get all links/all tags from the web page? thanks Suvo On Oct 12, 5:23 pm, Chuck van der Linden sqa...@gmail.com wrote: On Oct 12, 12:47 pm, Babu suvodasgu...@gmail.com wrote: but if i not include watir then how ican get all html tags value from the firefox webpage? On Oct 12, 1:52 pm, Chuck van der Linden sqa...@gmail.com wrote: Include isn't doing what you think it is. read this:http://wiki.openqa.org/display/WTR/include+Watir If you are using watir-webdriver, it has all the functionality you need, and since many of the methods and objects etc have the same name, it's just going to hopelessly confuse your poor system if you try to use both at the same time inside your scripts. (ok I know that's maybe not technically accurate, but it's an easy way of trying to explain why what he's trying to do is 'a bad thing' ) -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Re: Firefox not able to open through Watir
yes watir-webdriver is based of of watir you should have access to all the methods supported by elements http://pettichord.com/watirtutorial/docs/watir_cheat_sheet/WTR/Methods%20supported%20by%20Element.html On Wed, Oct 12, 2011 at 9:14 PM, Babu suvodasgu...@gmail.com wrote: i was wrong.. i mean to say require 'watir' if i don't use this then i can't get all the HTML tags so f i use require 'rubygems' require 'watir-webdriver' browser = Watir::Browser.new :firefox then can i get all links/all tags from the web page? thanks Suvo On Oct 12, 5:23 pm, Chuck van der Linden sqa...@gmail.com wrote: On Oct 12, 12:47 pm, Babu suvodasgu...@gmail.com wrote: but if i not include watir then how ican get all html tags value from the firefox webpage? On Oct 12, 1:52 pm, Chuck van der Linden sqa...@gmail.com wrote: Include isn't doing what you think it is. read this:http://wiki.openqa.org/display/WTR/include+Watir If you are using watir-webdriver, it has all the functionality you need, and since many of the methods and objects etc have the same name, it's just going to hopelessly confuse your poor system if you try to use both at the same time inside your scripts. (ok I know that's maybe not technically accurate, but it's an easy way of trying to explain why what he's trying to do is 'a bad thing' ) -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.comhttp://groups.google.com/group/watir-general%0awatir-general+unsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com