Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8961127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:48:55+00:00 2026-06-15T15:48:55+00:00

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

  • 0

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 with it.
I am trying to select the first ‘checkbox’ input element link.
I am having problems selecting the element.
I cannot use the db ID (104) as this is for repeated tests with new ID’s each time. I need to select the ‘first’ input checkbox, based on it having the text for Language Therapist.

I have tried:

xpath=(//li[contains(@id,'activity_roles_input')])//input

and

xpath=(//li[contains(@id,'activity_roles_input')])//contains('Language Therapist")

but it is not finding the element.

When I do:

xpath=(//li[contains(@id,'activity_roles_input')])

it gets to the input set. The problem I am having is selecting the first input checkbox control for ‘Language Therapist’.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:48:56+00:00Added an answer on June 15, 2026 at 3:48 pm

    First, find any <li> containing the text and than look for in the descendant of those for the first checkbox.

    xpath=(//li[contains(., "Language Therapist")]/descendant::input[@type="checkbox"][1])
    

    (From Michael)

    The above worked for me. In the end I actually used

    xpath=(//li[contains(@id,'activity_roles_input')]/descendant::input[@type="checkbox"][1])
    

    becuase I liked ID’ing by css ID.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given this HTML: <div id=foo> <input type=button class=foo abtn_1> <input type=button class=joe bbtn_2> <input
Given this HTML: <div id=foo> <input type=button class=foo abtn_1> <input type=button class=joe bbtn_2> <input
Given this html: <div class=nation> <a href=library.php?type=nation&amp;id=America> <div class=nation-image> <img src=nations/America.png alt=snip /> </div>
Given this HTML: <div class=OpenIDSelector>some text</div> Why does this JQuery selector match it on
Given this HTML: <form id=formx> <input type=text value= /> </form> And this JavaScript: $(function()
Given this markup: // Calendar.html?date=1/2/2003 <script> $(function() { $('.inlinedatepicker').datepicker(); }); </script> ... <div class=inlinedatepicker
Given this simplified snippet : <html> <body> <div> <div style='text-align:center;'>asdfaskjdfakjsd</div> <div style='float:right'> <input type='submit'
Given this HTML: <div id=TABLE1 class=tabs> <table> <tbody datasrc=Music> <tr id=randomid>lorem</tr> <tr id=foo>lorem</tr> <tr
I have some HTML like this: <div id=SomeID> <div class=Wrapper> <input type=checkbox class=SomeCheckboxClass> <input
given this html: <li id=the_list_item><img src=some_img></li> and this selectior: $(#the_list_item) I want to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.