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 9083231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:43:50+00:00 2026-06-16T20:43:50+00:00

Here is the code: <li class=abc> <div class=abc> <input type=checkbox> </div> <div class=xyz> <div

  • 0

Here is the code:

<li class="abc">
    <div class="abc">
         <input type="checkbox">
    </div>

    <div class="xyz">
        <div class="headline">Mongo like candy</div>
    <div>
</li>

<li class="abc">
    <div class="abc">
        <input type="checkbox">
    </div>

    <div class="xyz">
        <div class="headline">Candygram for mongo</div>
    <div>
</li>

Xpath challenge. I want locate the checkbox of the li which contains the headline “Mongo like candy” so I can select it using Selenium. In other words, how do you locate the checkbox from here:

li//div[@class='abc']//input[@type='checkbox']

but qualifying it with a different attribute within the same parent node:

li//div[@headline][contains(text(),"Mongo like candy")]
  • 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-16T20:43:52+00:00Added an answer on June 16, 2026 at 8:43 pm

    The basic idea is to qualify the final path with a predicate, i.e.

    li[/*predicate here*/]//div[@class='abc']//input[@type='checkbox']
    

    The predicate expresses the condition on the li that you want:

    .//div[@class='headline' and contains(text(), "Mongo like candy")]
    

    Putting them together yields:

    li[.//div[@class='headline' and contains(text(), "Mongo like candy")]]//div[@class='abc']//input[@type='checkbox']
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have my form elements here: <li><div id=formanswer1 class=clonedInput>Answer: <input type=text id=formanswer1 value= /></div></li>
Here is my code: class MyTestCase(Base): def setUp(self): #some code here def test_B(self): #some
Here is code example class A{ int i; public: A(int i) : i(i) {}
Here is the code: class Class1 { private Class2 object; public Class1(Class2 obj) :
Here is some code: class Person def initialize(age) @age = age end def age
Here's the code: class qual { public static int fibonacci(int n) { if (n
Here is the code: class Time { public static void printTime (int hour, int
Here is my code: class Soldier { public: Soldier(const string &name, const Gun &gun);
here's the code: class Acount { int sum ; String owner ; //these seem
I found this code here class Usable; class Usable_lock { friend class Usable; private:

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.