Re: [wtr-general] Can you create an array from the values in a select list?

2012-11-26 Thread Adrian Killens
Perfect! Thank you :-)

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

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] Can you create an array from the values in a select list?

2012-11-22 Thread Jarmo Pertman
You can also do it like this:
b.select_list(:id, 'blah').options.map(&:value)

Jarmo Pertman
-
IT does really matter - http://itreallymatters.net


On Thursday, November 22, 2012 6:32:24 AM UTC+2, Oscar.Rieken wrote:
>
> I have a few questions. 
> Why would you want to collect the values to make sure they are in the 
> select? what if they are not in the right order? what if the text and the 
> values do not match up correctly?
>
> what value is this test really giving?
>
> but to answer your question which you were on the right track. something 
> like this could work
>
> select_list = b.select_list(:id, 'blah')
> select_list.options.collect{ |i| i.attribute_value("value")}
>
>
> On Wed, Nov 21, 2012 at 11:06 PM, Adrian Killens 
> 
> > wrote:
>
>> It looks like this and I'd live to get an array of 1, 2, 3 rather than 
>> Thing One, Thing Two, Thing Three.
>>
>> 
>> Thing One
>> Thing Two
>> Thing Three
>> 
>>
>> Hope that makes sense.
>>
>>
>> On Thursday, 22 November 2012 00:37:33 UTC, Oscar.Rieken wrote:
>>
>>> what does the html of the select list look like 
>>>
>>>
>>> On Wed, Nov 21, 2012 at 5:14 PM, Adrian Killens 
>>> wrote:
>>>
 I can do it with options like this:

 selectList = b.select_list(:id, 'blah')
   selectContent = selectList.values.map(&:text)
   b.select(:id, 'blah').select_value(**selectContent[1])


 But was wondering how I could do the same thing using the value rather 
 than just the option?

 Cheers
 Aidy

 -- 
 Before posting, please read http://watir.com/support. In short: search 
 before you ask, be nice.
  
 watir-...@googlegroups.com
 http://groups.google.com/**group/watir-general
 watir-genera...@**googlegroups.com

>>>
>>>  -- 
>> Before posting, please read http://watir.com/support. In short: search 
>> before you ask, be nice.
>>  
>> watir-...@googlegroups.com 
>> http://groups.google.com/group/watir-general
>> watir-genera...@googlegroups.com 
>>
>
>

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

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] Can you create an array from the values in a select list?

2012-11-21 Thread Oscar Rieken
I have a few questions.
Why would you want to collect the values to make sure they are in the
select? what if they are not in the right order? what if the text and the
values do not match up correctly?

what value is this test really giving?

but to answer your question which you were on the right track. something
like this could work

select_list = b.select_list(:id, 'blah')
select_list.options.collect{ |i| i.attribute_value("value")}


On Wed, Nov 21, 2012 at 11:06 PM, Adrian Killens wrote:

> It looks like this and I'd live to get an array of 1, 2, 3 rather than
> Thing One, Thing Two, Thing Three.
>
> 
> Thing One
> Thing Two
> Thing Three
> 
>
> Hope that makes sense.
>
>
> On Thursday, 22 November 2012 00:37:33 UTC, Oscar.Rieken wrote:
>
>> what does the html of the select list look like
>>
>>
>> On Wed, Nov 21, 2012 at 5:14 PM, Adrian Killens wrote:
>>
>>> I can do it with options like this:
>>>
>>> selectList = b.select_list(:id, 'blah')
>>>   selectContent = selectList.values.map(&:text)
>>>   b.select(:id, 'blah').select_value(**selectContent[1])
>>>
>>>
>>> But was wondering how I could do the same thing using the value rather
>>> than just the option?
>>>
>>> Cheers
>>> Aidy
>>>
>>> --
>>> Before posting, please read http://watir.com/support. In short: search
>>> before you ask, be nice.
>>>
>>> watir-...@googlegroups.com
>>> http://groups.google.com/**group/watir-general
>>> watir-genera...@**googlegroups.com
>>>
>>
>>  --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> watir-general@googlegroups.com
> http://groups.google.com/group/watir-general
> watir-general+unsubscr...@googlegroups.com
>

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

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] Can you create an array from the values in a select list?

2012-11-21 Thread Adrian Killens
It looks like this and I'd live to get an array of 1, 2, 3 rather than 
Thing One, Thing Two, Thing Three.


Thing One
Thing Two
Thing Three


Hope that makes sense.

On Thursday, 22 November 2012 00:37:33 UTC, Oscar.Rieken wrote:
>
> what does the html of the select list look like 
>
>
> On Wed, Nov 21, 2012 at 5:14 PM, Adrian Killens 
> 
> > wrote:
>
>> I can do it with options like this:
>>
>> selectList = b.select_list(:id, 'blah')
>>   selectContent = selectList.values.map(&:text)
>>   b.select(:id, 'blah').select_value(selectContent[1])
>>
>>
>> But was wondering how I could do the same thing using the value rather 
>> than just the option?
>>
>> Cheers
>> Aidy
>>
>> -- 
>> Before posting, please read http://watir.com/support. In short: search 
>> before you ask, be nice.
>>  
>> watir-...@googlegroups.com 
>> http://groups.google.com/group/watir-general
>> watir-genera...@googlegroups.com 
>>
>
>

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

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] Can you create an array from the values in a select list?

2012-11-21 Thread Oscar Rieken
what does the html of the select list look like


On Wed, Nov 21, 2012 at 5:14 PM, Adrian Killens wrote:

> I can do it with options like this:
>
> selectList = b.select_list(:id, 'blah')
>   selectContent = selectList.values.map(&:text)
>   b.select(:id, 'blah').select_value(selectContent[1])
>
>
> But was wondering how I could do the same thing using the value rather
> than just the option?
>
> Cheers
> Aidy
>
> --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> watir-general@googlegroups.com
> http://groups.google.com/group/watir-general
> watir-general+unsubscr...@googlegroups.com
>

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

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] Can you create an array from the values in a select list?

2012-11-21 Thread Adrian Killens
I can do it with options like this:

selectList = b.select_list(:id, 'blah')
  selectContent = selectList.values.map(&:text)
  b.select(:id, 'blah').select_value(selectContent[1])


But was wondering how I could do the same thing using the value rather than 
just the option?

Cheers
Aidy

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

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com