Watirloo now has a simple implementation of RadioGroup that treats radios
sharing the same name as a group.
Download and run tests to see it in action
http://www.bitbucket.org/marekj/watirloo/src/tip/lib/watirloo.rb

so for previous example the code is like so:

browser.radio_group('email_frequency').options #=> ['daily',
'weekly','monthly']
browser.radio_group('email_frequency').set 'daily'

this is just a first pass but works for my tests.
Here are the tests showing the radio_group method and a wrapper usage
http://www.bitbucket.org/marekj/watirloo/src/tip/test/radio_group_test.rb

give it a spin
-- 
marekj
http://www.bitbucket.org/marekj/watirloo/
Watir Helper Framework


On Wed, Nov 12, 2008 at 5:28 PM, marekj <[EMAIL PROTECTED]> wrote:

> On Wed, Nov 12, 2008 at 7:20 AM, TCBlues <[EMAIL PROTECTED]> wrote:
>
>>
>> How could I get all the possible values of a radio button?
>> For example if I  have something like:
>>  <input type="radio" name="email_frequency" value="daily">Daily Email</
>> input>
>>  <input type="radio" name="email_frequency" value="weekly">Weekly
>> Email</input>
>>  <input type="radio" name="email_frequency" value="monthly">Monthly
>> Email</input>
>>
>> How could I get all the possible values: daily, weekly and monthly
>>
>>
> you are going to have to wait until we build the radio_group in Watirloo
> but in the meantime I use this helper method for radio groups and for
> checkbox groups
>
>   def get_values_by_name(name)
>     value_list = []
>     @browser.document.getElementsByName(name).each do |el|
>       value_list << el.attributes('value').value
>     end
>     return value_list
>   end
>
> in your example
>
> page.get_values_by_name('email_frequency')
> # => ['daily', 'weekly', 'monthly']
>
> and page object is the semantic wrapper in Watirloo that provides @browser
>
> if you don't want to bother with Page class then use the guts of the method
> directly.
>
> ---
> marekj | i can has watir framework
> http://www.bitbucket.org/marekj/watirloo/
> Semantic Page Objects Modeling in Watir
>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to