I have something funny going on with my WATIR. code.

in the code below, test.txt file has about 50 lines.. for example, line
number 1 is 'test1', number 2 is 'test2', and so on..

I am trying to choose this line value in the select box in the web page
one by one from the local text file and process it.

in the below code, the line..

ie.select_list( :name , "leftsegments").select("#{$Guide}")

is supposed to choose test1 from the select box, which is the first
line in the test.txt file.  Now even though test1 is one of the values
in the select box, the message says 'there is no 'text1' in the select
list.

so I tried the code below again with

ie.select_list( :name , "leftsegments").select("test1")

and it works fine..

what am I doing wrong??   the select box in the web page has more than
150 values.. maybe too many values to choose from??  is that confusing
the WATIR code??  but what about the error message that says 'there is
no test1 in the select list'????

could anyone help and tell me what I am doing wrong??

thanks.

========================================================================
require 'watir'

ie = Watir::IE.start("http://www.testing.com")
ie.link(:text, "New Page").click
file = File.open("c:/test.txt", "r")
lines = file.readlines()
0.upto(lines.length - 1) {|j|
$Guide = lines[j]
ie.button(:name, "choose_segments").click
ie.select_list( :name , "leftsegments").select("#{$Guide}")
ie.button(:name, "leftsegmentsButton").click
}
file.close() 
lines.clear()