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

Reply via email to