Re: [wtr-general] Retrieving checkbox values

2011-10-12 Thread Željko Filipin
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


Re: [wtr-general] Retrieving checkbox values

2011-10-12 Thread Joe Fleck
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