Given this HTML:
<li class="check_boxes input optional" id="activity_roles_input"> <fieldset class="choices"> <legend class="label"><label>Roles</label></legend> <input id="activity_roles_none" name="activity[role_ids][]" type="hidden" value="" /> <ol class="choices-group"> <li class="choice"> <label for="activity_role_ids_104"> <input id="activity_role_ids_104" name="activity[role_ids][]" type="checkbox" value="104" />Language Therapist </label> </li> <li class="choice"> <label for="activity_role_ids_103"> <input id="activity_role_ids_103" name="activity[role_ids][]" type="checkbox" value="103" />Speech Therapist </label> </li> </ol> </fieldset> </li>
I am trying to use Selenium and xpath. I am trying to select the first link of the checkbox input element.
I have problems with selecting an item.
I cannot use the db identifier (104), as this is repeated for repeated tests with a new identifier each time. I need to select the "first" input check box, based on the fact that it has text for Language Therapist.
I tried:
xpath=(//li[contains(@id,'activity_roles_input')])//input
and
xpath=(//li[contains(@id,'activity_roles_input')])//contains('Language Therapist")
but he does not find the element.
When I do this:
xpath=(//li[contains(@id,'activity_roles_input')])
he gets to the input set. The problem I am facing is to select the first checkbox for "Language Therapist".
source share