click    //[EMAIL PROTECTED]'radio' and following-sibling::text()[1]='  MD']

Which mean: find the input of type='radio' for which the next 'sibling' text
is '  MD'.
To make sure it works, replace '  MD' with ' EdD' and you should see the
correct radio being selected.

Also, (will work in this particular case, but the above syntax is better)
click    //[EMAIL PROTECTED]'radio' and position()=1]
or
click    //[EMAIL PROTECTED]'radio'][1]

- Guillaume Boudreau

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Hamilton Chua
Sent: Friday, October 14, 2005 9:53 AM
To: selenium-users@lists.public.thoughtworks.org
Subject: [Selenium-users] selecting text right after a radio button
usingxpath

Hello,

This is a tough one to crack.

My application generates a set of radio buttons dynamicaly like so

***********

                 <input type="radio" name="response_to_item.24306" 
value="24310" id="show_item_form:elements:response_to_item.24306:24310" 
checked="checked" />  MD<br>
              
                 <input type="radio" name="response_to_item.24306" 
value="24311" id="show_item_form:elements:response_to_item.24306:24311"  />
PhD<br>
              
                 <input type="radio" name="response_to_item.24306" 
value="24312" id="show_item_form:elements:response_to_item.24306:24312"  />
ScD<br>

              
                 <input type="radio" name="response_to_item.24306" 
value="24313" id="show_item_form:elements:response_to_item.24306:24313"  />
PharmD<br>
              
                 <input type="radio" name="response_to_item.24306" 
value="24314" id="show_item_form:elements:response_to_item.24306:24314"  />
EdD<br>
              
                 <input type="radio" name="response_to_item.24306" 
value="24315" id="show_item_form:elements:response_to_item.24306:24315"  />
RN<br>
              
                 <input type="radio" name="response_to_item.24306" 
value="24316" id="show_item_form:elements:response_to_item.24306:24316"  />
Other/Additional (please specify below)<br>

************

I need to click the radio button based on the text right after it.  Selenium
allows me to click on a radio button by doing something like

click    //[EMAIL PROTECTED]'24310']

but the problem is that the values of the checkboxes are dynamically
generated, on the text after the dynamically generated radio button is not.

Is there a way to have selenium select the radio button that precedes a
matching string ?

For example I want to select the radio button that corresponds to 'MD'.

Thanks,

Hamilton


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

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

Reply via email to