Shlomit,

Let's check the attributes of each of the radios.
Perhaps in actuality an attribute is NOT set
as one would expect it to be.

Run this code prior to the previous code block and look at the
results.
Feel free to add puts statements for any additional attributes you may
want to collect.


      # Loop trough radios to display their attributes
      $ie.radios.each_with_index do | radio, iIndex |

            # Adjust index, as radios are 1 indexed, and arrays are
zero indexed
            iIndex = iIndex +1

            puts("\n#-------------------------#")
            puts("# Attributes of radio " + iIndex.to_s)
            puts("#-------------------------#")
            puts("id:  " + $ie.radio(:index, iIndex).id.to_s)
            puts("alt:  " + $ie.radio(:index, iIndex).alt.to_s)
            puts("class:  " + $ie.radio(:index, iIndex).class.to_s)
            puts("enabled?:  " + $ie.radio(:index, iIndex).enabled?.to_s)
            puts("getState:  " + $ie.radio(:index, iIndex).getState.to_s)
            puts("innerText:  " + $ie.radio(:index, iIndex).innerText.to_s)
            puts("isSet?:  " + $ie.radio(:index, iIndex).isSet?.to_s)
            puts("name:  " + $ie.radio(:index, iIndex).name.to_s)
            puts("type:  " + $ie.radio(:index, iIndex).type.to_s)
            puts("value:  " + $ie.radio(:index, iIndex).value.to_s)
            puts("visible?:  " + $ie.radio(:index, iIndex).visible?.to_s)
            puts("inspect:  " + $ie.radio(:index, iIndex).inspect.to_s)

  end


On Jul 4, 12:33 am, Shlomit Gazit <[email protected]> wrote:
> Joe,
>
> For example I was trying:
>
> $ie.radios.each do | radio |
>           if($ie.radio(:id,"ID_OTHER_OPTION_BUTTON"))
>             puts("yes")
>
>           else
>             puts("NO")
>           end
>         end
>
> The output was 15 yes instead of 1.
>
> On Jul 2, 9:05 am, joedio <[email protected]> wrote:
>
> > Schlomit,
>
> > Could you post the code you created from my example
> > so folks can look at it to try to determine why the conditional
> > is not working? Please include the output as well.
>
> > Thanks,
> > Joe
>
> > On Jul 2, 5:59 am, Željko Filipin <[email protected]>
> > wrote:
>
> > > 2010/7/2 Shlomit Gazit <[email protected]>
>
> > > > I want to create an array of the innerText (or something else) of the
> > > > 9 out of 16 radios on the page.
> > > > Then I need to do something with every variable in this array.
>
> > > Then just iterate over all radio buttons and create an array that contains
> > > just the ones you want:
>
> > > original_array = ["aa", "bb", "ab", "ba"]
>
> > > new_array = original_array.collect {|element| element if element =~ /a/ }
> > > => ["aa", nil, "ab", "ba"]
>
> > > # compact removes nil elements
> > > new_array.compact
> > > => ["aa", "ab", "ba"]
>
> > > Željko

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

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: [email protected]
To unsubscribe: [email protected]

Reply via email to