[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 jarm...@gmail.com wrote: On Jul 6, 12:21 am, Chuck van der Linden sqa...@gmail.com wrote: See commented line, then below    Functionally you are

[wtr-general] Re: Iterate through radio buttons

2010-07-07 Thread Jarmo Pertman
On Jul 6, 12:21 am, Chuck van der Linden sqa...@gmail.com 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

[wtr-general] Re: Iterate through radio buttons

2010-07-06 Thread Chuck van der Linden
On Jul 4, 6:30 am, arihan sinha arihan.si...@googlemail.com 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 shlomitpatr...@gmail.comwrote: For the HTML to be proper, the ID values should be unique, so

[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

[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))

[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

[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 shlomitpatr...@gmail.com 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

[wtr-general] Re: Iterate through radio buttons

2010-07-04 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 joe...@comcast.net wrote:

[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.

[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 joe...@comcast.net 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    

[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 shlomitpatr...@gmail.com wrote: Thank you! that's working. On Jul 1, 5:39 am, joedio joe...@comcast.net wrote: Shlomit, This may work

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 shlomitpatr...@gmail.com 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

[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

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

2010-07-02 Thread Željko Filipin
2010/7/2 Shlomit Gazit shlomitpatr...@gmail.com 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

[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 zeljko.fili...@wa-research.ch wrote: 2010/7/2 Shlomit Gazit

[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)