[wtr-general] Re: Iterate through radio buttons

2010-07-08 Thread Chuck van der Linden
Good point as to exaclty why it was evaluating to 'true'.  .  and
yes  .exists?  is your friend.  I use it often

On Jul 7, 3:33 am, Jarmo Pertman  wrote:
> On Jul 6, 12:21 am, Chuck van der Linden  wrote:
>
> > See commented line, then below
> >    Functionally you are saying "if there is a radio button on the page
> > with an ID value of  then put yes
>
> Actually this is not completely true because if you create an object
> with Watir, then the object itself is always created, e.g:
> $ie.radio(:id,"ID_OTHER_OPTION_BUTTON")
> $ie.radio(:id,"XX")
>
> both of these statements create a Watir::Radio object thus being true
> for if-statement, which means that the if statement mentioned above
> will be true always - even if there's no such radio.
>
> To check for existence, you'd have to invoke #exist?
> $ie.radio(:id,"XX").exist? # => false
>
> Just wanted to clarify :)
>
> Jarmo

-- 
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: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Iterate through radio buttons

2010-07-07 Thread Jarmo Pertman


On Jul 6, 12:21 am, Chuck van der Linden  wrote:
> See commented line, then below
>    Functionally you are saying "if there is a radio button on the page
> with an ID value of  then put yes

Actually this is not completely true because if you create an object
with Watir, then the object itself is always created, e.g:
$ie.radio(:id,"ID_OTHER_OPTION_BUTTON")
$ie.radio(:id,"XX")

both of these statements create a Watir::Radio object thus being true
for if-statement, which means that the if statement mentioned above
will be true always - even if there's no such radio.

To check for existence, you'd have to invoke #exist?
$ie.radio(:id,"XX").exist? # => false

Just wanted to clarify :)

Jarmo

-- 
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: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Iterate through radio buttons

2010-07-06 Thread Chuck van der Linden
On Jul 4, 6:30 am, arihan sinha  wrote:
> count the no of radio buttons with certain ids first then use the for loop
> for this
>
> On Thu, Jul 1, 2010 at 12:08 PM, Shlomit Gazit 
> wrote:

For the HTML to be proper, the ID values should be unique, so there's
no point to trying to count them.

Furthermore watir pretty much presumes where ID values are concerned
that the HTML is valid proper HTML and returns the first (and ONLY the
first) element on the page(of ANY KIND) that has an ID that matches
what you specified.  Parameters like index etc are generally ignored
if you specify ID as one of the 'how's of identifying an element.

-- 
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: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Iterate through radio buttons

2010-07-05 Thread Chuck van der Linden
See commented line, then below

On Jul 3, 11:33 pm, Shlomit Gazit  wrote:
> Joe,
>
> For example I was trying:
>
> $ie.radios.each do | radio |
>           if($ie.radio(:id,"ID_OTHER_OPTION_BUTTON"))  ### This does the same 
> thing every time
>             puts("yes")
>
>           else
>             puts("NO")
>           end
>         end
>
> The output was 15 yes instead of 1.
>

The thing being evaluated in your if statement is doing the same thing
every time, it's basicly returning an object, which not being zero is
going to be seen as true.
   Functionally you are saying "if there is a radio button on the page
with an ID value of  then put yes
Since nothing about that check changes, then each loop through it's
going to report the same result.. (e.g. it's doing just what you told
it to)

Instead the If line should be written to use the value being set with
each iteration, so that it will check each radio button in turn.  You
set tht to be called 'radio' so..

   if radio.id == "ID_OTHER_OPTION_BUTTON"

That's going to work because the code will loop through once for each
radio button, and each time, that particular instace of the radio
button is assigned to the variable 'radio', so it will have different
contents each time, and you can check to see if the ID value is the
one you want.

Joedio's last posting is basically the same as above, but perhaps this
provides a little more guidence so you see where you went wrong.

-- 
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: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Iterate through radio buttons

2010-07-05 Thread joedio
I got your original code to work as well

Joe


$ie.radios.each do | oMyObject |
  if(oMyObject .id == "ID_OTHER_OPTION_BUTTON")
puts("yes")
  else
puts("NO")
  end
  end

-- 
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: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Iterate through radio buttons

2010-07-05 Thread joedio
This code should work, I mocked it up and ran as expected.

$ie.radios.each_with_index do | radio, iIndex|

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

if(($ie.radio(:index, iIndex).id == "ID_OTHER_OPTION_BUTTON"))
   puts("Yes")
else
   puts("NO")
end
end

Joe

On Jul 5, 5:51 am, Shlomit Gazit  wrote:
> Hello Joe,
> Thank you for your help.
>
> The results are as follow: I dont need radios 10-15 for my test.
>
> #-#
> # Attributes of radio 1
> #-#
> id:  ID_LIMIT_OPTION_BUTTON
> alt:
> class:  Watir::Radio
> enabled?:  true
> getState:  false
> innerText:
> isSet?:  false
> name:  reqType
> type:  radio
> value:  Limit_1
> visible?:  true
> inspect:  # value=nil>
>
> #-#
> # Attributes of radio 2
> #-#
> id:  ID_PAYMENT_OPTION_BUTTON
> alt:
> class:  Watir::Radio
> enabled?:  true
> getState:  false
> innerText:
> isSet?:  false
> name:  reqType
> type:  radio
> value:  Payment_3
> visible?:  true
> inspect:  # value=nil>
>
> #-#
> # Attributes of radio 3
> #-#
> id:  ID_REGISTRATION_OPTION_BUTTON
> alt:
> class:  Watir::Radio
> enabled?:  true
> getState:  false
> innerText:
> isSet?:  false
> name:  reqType
> type:  radio
> value:  Registration_5
> visible?:  true
> inspect:  # value=nil>
>
> #-#
> # Attributes of radio 4
> #-#
> id:  ID_LABELLING_OPTION_BUTTON
> alt:
> class:  Watir::Radio
> enabled?:  true
> getState:  false
> innerText:
> isSet?:  false
> name:  reqType
> type:  radio
> value:  Labelling_7
> visible?:  true
> inspect:  # value=nil>
>
> #-#
> # Attributes of radio 5
> #-#
> id:  ID_TESTING_OPTION_BUTTON
> alt:
> class:  Watir::Radio
> enabled?:  true
> getState:  false
> innerText:
> isSet?:  false
> name:  reqType
> type:  radio
> value:  Testing_8
> visible?:  true
> inspect:  # value=nil>
>
> #-#
> # Attributes of radio 6
> #-#
> id:  ID_TARGET_OPTION_BUTTON
> alt:
> class:  Watir::Radio
> enabled?:  true
> getState:  false
> innerText:
> isSet?:  false
> name:  reqType
> type:  radio
> value:  Target_2
> visible?:  true
> inspect:  # value=nil>
>
> #-#
> # Attributes of radio 7
> #-#
> id:  ID_REPORTING_OPTION_BUTTON
> alt:
> class:  Watir::Radio
> enabled?:  true
> getState:  false
> innerText:
> isSet?:  false
> name:  reqType
> type:  radio
> value:  Reporting_4
> visible?:  true
> inspect:  # value=nil>
>
> #-#
> # Attributes of radio 8
> #-#
> id:  ID_CERTIFICATION_OPTION_BUTTON
> alt:
> class:  Watir::Radio
> enabled?:  true
> getState:  false
> innerText:
> isSet?:  false
> name:  reqType
> type:  radio
> value:  Certification_9
> visible?:  true
> inspect:  # value=nil>
>
> #-#
> # Attributes of radio 9
> #-#
> id:  ID_OTHER_OPTION_BUTTON
> alt:
> class:  Watir::Radio
> enabled?:  true
> getState:  true
> innerText:
> isSet?:  true
> name:  reqType
> type:  radio
> value:  Other_10
> visible?:  true
> inspect:  # value=nil>
>
> #-#
> # Attributes of radio 10
> #-#
> id:  SinglereqDetailDeadLine_1
> alt:
> class:  Watir::Radio
> enabled?:  true
> getState:  true
> innerText:
> isSet?:  true
> name:  radioRange_reqDetailDeadLine_1
> type:  radio
> value:  Single
> visible?:  true
> inspect:  # value=nil>
>
> #-#
> # Attributes of radio 11
> #-#
> id:  RangereqDetailDeadLine_1
> alt:
> class:  Watir::Radio
> enabled?:  true
> getState:  false
> innerText:
> isSet?:  false
> name:  radioRange_reqDetailDeadLine_1
> type:  radio
> value:  Range
> visible?:  true
> inspect:  # value=nil>
>
> #-#
> # Attributes of radio 12
> #-#
> id:  CustomreqDetailDeadLine_1
> alt:
> class:  Watir::Radio
> enabled?:  true
> getState:  false
> innerText:
> isSet?:  false
> name:  radioRange_reqDetailDeadLine_1
> type:  radio
> value:  Custom
> visible?:  true
> inspect:  # value=nil>
>
> #-#
> # Attributes of radio 13
> #-#
> id:  SinglereqDetailExpiration_1
> alt:
> class:  Watir::Radio
> enabled?:  true
> getState:  true
> innerText:
> isSet?:  true
> name:  radioRange_reqDetailExpiration_1
> type:  radio
> value:  Single
> visible?:  true
> inspect:  # value=nil>
>
> #-#
> # Attributes of radio 14
> #-#
> id:  RangereqDetailExpiration_1
> alt:
> class:  Watir::Radio
> enabled?:  true
> getState:  false
> innerText:
> isSet?:  false
> name:  radioRange_reqDetailExpiration_1
> type:  radio
> value:  Range
> visible?:  true
> inspect:  # v

[wtr-general] Re: Iterate through radio buttons

2010-07-05 Thread Shlomit Gazit
Hello Joe,
Thank you for your help.

The results are as follow: I dont need radios 10-15 for my test.


#-#
# Attributes of radio 1
#-#
id:  ID_LIMIT_OPTION_BUTTON
alt:
class:  Watir::Radio
enabled?:  true
getState:  false
innerText:
isSet?:  false
name:  reqType
type:  radio
value:  Limit_1
visible?:  true
inspect:  #

#-#
# Attributes of radio 2
#-#
id:  ID_PAYMENT_OPTION_BUTTON
alt:
class:  Watir::Radio
enabled?:  true
getState:  false
innerText:
isSet?:  false
name:  reqType
type:  radio
value:  Payment_3
visible?:  true
inspect:  #

#-#
# Attributes of radio 3
#-#
id:  ID_REGISTRATION_OPTION_BUTTON
alt:
class:  Watir::Radio
enabled?:  true
getState:  false
innerText:
isSet?:  false
name:  reqType
type:  radio
value:  Registration_5
visible?:  true
inspect:  #

#-#
# Attributes of radio 4
#-#
id:  ID_LABELLING_OPTION_BUTTON
alt:
class:  Watir::Radio
enabled?:  true
getState:  false
innerText:
isSet?:  false
name:  reqType
type:  radio
value:  Labelling_7
visible?:  true
inspect:  #

#-#
# Attributes of radio 5
#-#
id:  ID_TESTING_OPTION_BUTTON
alt:
class:  Watir::Radio
enabled?:  true
getState:  false
innerText:
isSet?:  false
name:  reqType
type:  radio
value:  Testing_8
visible?:  true
inspect:  #

#-#
# Attributes of radio 6
#-#
id:  ID_TARGET_OPTION_BUTTON
alt:
class:  Watir::Radio
enabled?:  true
getState:  false
innerText:
isSet?:  false
name:  reqType
type:  radio
value:  Target_2
visible?:  true
inspect:  #

#-#
# Attributes of radio 7
#-#
id:  ID_REPORTING_OPTION_BUTTON
alt:
class:  Watir::Radio
enabled?:  true
getState:  false
innerText:
isSet?:  false
name:  reqType
type:  radio
value:  Reporting_4
visible?:  true
inspect:  #

#-#
# Attributes of radio 8
#-#
id:  ID_CERTIFICATION_OPTION_BUTTON
alt:
class:  Watir::Radio
enabled?:  true
getState:  false
innerText:
isSet?:  false
name:  reqType
type:  radio
value:  Certification_9
visible?:  true
inspect:  #

#-#
# Attributes of radio 9
#-#
id:  ID_OTHER_OPTION_BUTTON
alt:
class:  Watir::Radio
enabled?:  true
getState:  true
innerText:
isSet?:  true
name:  reqType
type:  radio
value:  Other_10
visible?:  true
inspect:  #

#-#
# Attributes of radio 10
#-#
id:  SinglereqDetailDeadLine_1
alt:
class:  Watir::Radio
enabled?:  true
getState:  true
innerText:
isSet?:  true
name:  radioRange_reqDetailDeadLine_1
type:  radio
value:  Single
visible?:  true
inspect:  #

#-#
# Attributes of radio 11
#-#
id:  RangereqDetailDeadLine_1
alt:
class:  Watir::Radio
enabled?:  true
getState:  false
innerText:
isSet?:  false
name:  radioRange_reqDetailDeadLine_1
type:  radio
value:  Range
visible?:  true
inspect:  #

#-#
# Attributes of radio 12
#-#
id:  CustomreqDetailDeadLine_1
alt:
class:  Watir::Radio
enabled?:  true
getState:  false
innerText:
isSet?:  false
name:  radioRange_reqDetailDeadLine_1
type:  radio
value:  Custom
visible?:  true
inspect:  #

#-#
# Attributes of radio 13
#-#
id:  SinglereqDetailExpiration_1
alt:
class:  Watir::Radio
enabled?:  true
getState:  true
innerText:
isSet?:  true
name:  radioRange_reqDetailExpiration_1
type:  radio
value:  Single
visible?:  true
inspect:  #

#-#
# Attributes of radio 14
#-#
id:  RangereqDetailExpiration_1
alt:
class:  Watir::Radio
enabled?:  true
getState:  false
innerText:
isSet?:  false
name:  radioRange_reqDetailExpiration_1
type:  radio
value:  Range
visible?:  true
inspect:  #

#-#
# Attributes of radio 15
#-#
id:  CustomreqDetailExpiration_1
alt:
class:  Watir::Radio
enabled?:  true
getState:  false
innerText:
isSet?:  false
name:  radioRange_reqDetailExpiration_1
type:  radio
value:  Custom
visible?:  true
inspect:  #
E
Finished in 153.359 seconds.

On Jul 4, 7:17 am, joedio  wrote:
> 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("# A

[wtr-general] Re: Iterate through radio buttons

2010-07-04 Thread joedio
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  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  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 
> > wrote:
>
> > > 2010/7/2 Shlomit Gazit 
>
> > > > 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: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Iterate through radio buttons

2010-07-03 Thread Shlomit Gazit
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  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 
> wrote:
>
>
>
> > 2010/7/2 Shlomit Gazit 
>
> > > 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: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Iterate through radio buttons

2010-07-02 Thread joedio
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 
wrote:
> 2010/7/2 Shlomit Gazit 
>
> > 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: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] Re: Iterate through radio buttons

2010-07-02 Thread Željko Filipin
2010/7/2 Shlomit Gazit 
> 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: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Iterate through radio buttons

2010-07-02 Thread Shlomit Gazit
Hello Željko,
Because I dont need to iterate over all radio buttons.
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.

Shlomit

On Jul 2, 4:34 am, Željko Filipin 
wrote:
> On Fri, Jul 2, 2010 at 12:09 PM, Shlomit Gazit 
> wrote:
>
> > The condition is not working, it is still
> > going through all the radio buttons.
>
> Joe's code if working fine. browser.radios.each means iterate over all radio
> buttons.
>
> Why do you insist on not iterating over all radio buttons? Speed?
>
> Željko
> --
> watir.com - community manager
> watirpodcast.com - host
> testingpodcast.com - audio podcasts on software testing. all of them
> vidipodkast.com - pričamo o hardveru, softveru i časopisu Vidi

-- 
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: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] Re: Iterate through radio buttons

2010-07-02 Thread Željko Filipin
On Fri, Jul 2, 2010 at 12:09 PM, Shlomit Gazit 
wrote:
> The condition is not working, it is still
> going through all the radio buttons.

Joe's code if working fine. browser.radios.each means iterate over all radio
buttons.

Why do you insist on not iterating over all radio buttons? Speed?

Željko
--
watir.com - community manager
watirpodcast.com - host
testingpodcast.com - audio podcasts on software testing. all of them
vidipodkast.com - pričamo o hardveru, softveru i časopisu Vidi

-- 
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: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Iterate through radio buttons

2010-07-02 Thread Shlomit Gazit
Hello Joe,
It is actually doesnt work. The condition is not working, it is still
going through all the radio buttons.

On Jul 2, 1:51 am, Shlomit Gazit  wrote:
> Thank you! that's working.
>
> On Jul 1, 5:39 am, joedio  wrote:
>
>
>
> > Shlomit,
>
> > This may work for your situation:
>
> > # Define the element ID to be acted upon
> > myID =  "your_id"
>
> > # Loop through the radio elements
> > browser.radios.each do | radio |
>
> >    # Separate the matching radios
> >    if(browser.radio(:id,  myID ))
> >       # Do whatever you need to do with it (e.g. set it)
> >       browser.radio(:id,  myID ).set
> >    end
>
> > end # End of Loop
>
> > Hope that helps,
> > Joe
>
> > On Jul 1, 5:08 am, Shlomit Gazit  wrote:
>
> > > I am trying to iterate through radio buttons in the page, but I dont
> > > want to iterate through all the radios in the page, only those with
> > > certain id.
> > > How can I do that?

-- 
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: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Iterate through radio buttons

2010-07-02 Thread Shlomit Gazit
Thank you! that's working.

On Jul 1, 5:39 am, joedio  wrote:
> Shlomit,
>
> This may work for your situation:
>
> # Define the element ID to be acted upon
> myID =  "your_id"
>
> # Loop through the radio elements
> browser.radios.each do | radio |
>
>    # Separate the matching radios
>    if(browser.radio(:id,  myID ))
>       # Do whatever you need to do with it (e.g. set it)
>       browser.radio(:id,  myID ).set
>    end
>
> end # End of Loop
>
> Hope that helps,
> Joe
>
> On Jul 1, 5:08 am, Shlomit Gazit  wrote:
>
>
>
> > I am trying to iterate through radio buttons in the page, but I dont
> > want to iterate through all the radios in the page, only those with
> > certain id.
> > How can I do that?

-- 
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: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: Iterate through radio buttons

2010-07-01 Thread joedio
Shlomit,

This may work for your situation:

# Define the element ID to be acted upon
myID =  "your_id"

# Loop through the radio elements
browser.radios.each do | radio |

   # Separate the matching radios
   if(browser.radio(:id,  myID ))
  # Do whatever you need to do with it (e.g. set it)
  browser.radio(:id,  myID ).set
   end

end # End of Loop


Hope that helps,
Joe

On Jul 1, 5:08 am, Shlomit Gazit  wrote:
> I am trying to iterate through radio buttons in the page, but I dont
> want to iterate through all the radios in the page, only those with
> certain id.
> How can I do that?

-- 
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: watir-general@googlegroups.com
To unsubscribe: watir-general+unsubscr...@googlegroups.com