Rahul Chaturvedi wrote:

In a page there are 4 radio buttons which are having same names (They don't have ids or any other attribute to distinguish).

...

<td><input type="radio" name="name1"></input></td><td></td>
...
<td><input type="radio" name="name1"></input></td><td></td>
...
<td><input type="radio" name="name1"></input></td><td></td>
...
<td><input type="radio" name="name1"></input></td><td></td>

Now using Selenium I need to click 3rd radio button. How can I do this.

xpath=//[EMAIL PROTECTED]'name1'][2] might work.

But, I'm perplexed by your example. Surely your radio-buttons must have *some* distinguishing attribute; otherwise, how will the server know which one you selected?! Usually groups of radio-buttons with the same name have different values, in which case you could use something like

   xpath=//[EMAIL PROTECTED]'name1' and @value='whatever']

As it happens, I've just added better support for toggle-buttons (ie. radio-buttons and check-boxes) to what will become Selenium-0.7. It allows you to do things like

   | check | name1 value=whatever |

or even

   | check | name1 index=2 |

--
cheers, MikeW                            http://www.dogbiscuit.org/mdub/

_______________________________________________
Selenium-users mailing list
Selenium-users@lists.public.thoughtworks.org
http://lists.public.thoughtworks.org/mailman/listinfo/selenium-users

Reply via email to