Re: [wtr-general] How to easily get button index?

2009-12-10 Thread Željko Filipin
On Thu, Dec 10, 2009 at 3:20 AM, Marlon marlonmoja...@gmail.com wrote:
 How can I easy get button index?

counter = 1
browser.buttons.each do |button|
  puts index:#{counter}
  puts button.to_s
  puts
  counter += 1
end

Please let me know if you would like me to comment the code.

Željko
--
watir.com - community manager
watirpodcast.com - host

-- 
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

Re: [wtr-general] How to easily get button index?

2009-12-10 Thread Paul Rogers
i think the each is done by including enumberable (
http://ruby-doc.org/core/classes/Enumerable.html)  module ( it was way back
anyway), so any methods in the enumberable module should just work:

ie.buttons.each_with_index do |button, i|
 puts index for bytton with id #{button.id} is #{ i + 1 }   # watir is
1 based, each with index is 0 based
end



Paul


On Thu, Dec 10, 2009 at 4:38 AM, Željko Filipin 
zeljko.fili...@wa-research.ch wrote:

 On Thu, Dec 10, 2009 at 3:20 AM, Marlon marlonmoja...@gmail.com wrote:
  How can I easy get button index?

 counter = 1
 browser.buttons.each do |button|
   puts index:#{counter}
   puts button.to_s
   puts
   counter += 1
 end

 Please let me know if you would like me to comment the code.


 Željko
 --
 watir.com - community manager
 watirpodcast.com - host



  --
 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


-- 
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