On Oct 19, 11:14 am, Joe Fl <[email protected]> wrote:
> Hi,
>
> I have figure it out.
>
> Code...
> names = $browser.select_list(:name,'communities').options
>
> community_names_arr = Array.new
>
> commuName = ""
>
> name_number = 0
>
> names.each do |name|
>
>   puts commuName = "#{name_number}: #{name.text}"
>
>   name_number = name_number + 1
>
> end
>
> this gives me the text to each option in the listbox.
>

You might want to make use of .each_with_index to make your code a
little easier and cleaner

names = $browser.select_list(:name,'communities').options

community_names_arr = Array.new

commuName = ""

names.each_with_index do |name, i|

  puts commuName = "#{i}: #{name.text}"

end

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to