logo       

Re: selecting text right after a radio button usingxpath: msg#00049

web.selenium.user

Subject: Re: selecting text right after a radio button usingxpath

Thank You so very very much :-)

On Friday 14 October 2005 10:35 pm, Guillaume Boudreau wrote:
> click //input[@type='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 //input[@type='radio' and position()=1]
> or
> click //input[@type='radio'][1]
>
> - Guillaume Boudreau
>
> -----Original Message-----
> From:
> selenium-users-bounces-EcuzILgp2tAZVhN9JVcPDEqbzN8AcRLmILAQCsJbaHk@xxxxxxxxxxxxxxxx
> [mailto:selenium-users-bounces-EcuzILgp2tAZVhN9JVcPDEqbzN8AcRLmILAQCsJbaHk@xxxxxxxxxxxxxxxx]
> On Behalf Of
> Hamilton Chua
> Sent: Friday, October 14, 2005 9:53 AM
> To:
> selenium-users-EcuzILgp2tAZVhN9JVcPDEqbzN8AcRLmILAQCsJbaHk@xxxxxxxxxxxxxxxx
> 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 //input[@value='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-EcuzILgp2tAZVhN9JVcPDEqbzN8AcRLmILAQCsJbaHk@xxxxxxxxxxxxxxxx
> http://lists.public.thoughtworks.org/mailman/listinfo/selenium-users


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise