[prev in list] [next in list] [prev in thread] [next in thread] 

List:       selenium-users
Subject:    Re: [Selenium-users] selecting text right after a radio button
From:       Hamilton Chua <hamilton.chua () gmail ! com>
Date:       2005-10-14 15:05:58
Message-ID: 200510142305.59477.hamilton.chua () gmail ! com
[Download RAW message or body]

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@lists.public.thoughtworks.org
> [mailto:selenium-users-bounces@lists.public.thoughtworks.org] 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    //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@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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic