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 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to