I wanted to get the list of options and then have it select one of them. 
Interesting that I have to include the .text to dereference the string. 
That worked thanks for the help. I was searching all over trying to find 
how to get the value so I could select it.

krizzo

On Tuesday, April 24, 2012 2:05:26 PM UTC-6, Dan wrote:
>
> I'm not sure what you're trying to do exactly, but you need to tell it 
> you're looking for the text 
>
> puts contents[0].text
>
> You also may want to consider something like this instead of an array, but 
> again I'm not really sure what you're trying to do.
>
> b.select_list(:name => 'entry.6.single').options.each do |opt|
>   p opt.text
> end
>
> On Tuesday, April 24, 2012 3:30:04 PM UTC-4, krizzo wrote:
>>
>> I created this test script because I was having issues with another 
>> script that needed to work with select_list. This is having the same issue. 
>> From my understanding "contents[0]" should print out "Firefox" but instead 
>> I get a memory location. I printed the "memory" location out and it's not a 
>> simple array of the options it almost looks like the browser object.
>>
>> I wanted to know if this was a known issue or is my understanding 
>> incorrect on options returning an array?
>>
>> ## Output 
>> #<Watir::Option:0x816f138>
>> [
>>     [0] "test",
>>     [1] "one",
>>     [2] "two",
>>     [3] "three"
>> ]
>>
>> ## Test Script
>>
>> require 'rubygems'
>> require 'ap'
>> require 'watir-webdriver'
>> url = "
>> https://spreadsheets.google.com/viewform?hl=en&formkey=dDliTk5XU1R4RUMtb2c1WDZxWHNENmc6MQ#gid=0
>> "
>> myArray = %w[test one two three] 
>> b = Watir::Browser.new :firefox, :profile => 'LoL'
>> b.goto url
>> contents = Array.new
>> contents = b.select_list(:name => 'entry.6.single').options
>> puts contents[0]
>> ap myArray
>> b.close
>>
>>

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