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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:13:58+00:00 2026-06-10T04:13:58+00:00

I have an element in my code that’s used on many pages in many

  • 0

I have an element in my code that’s used on many pages in many places. Specifically, it’s a calendar element. This element contains many parts, however, these internal parts are always the same no matter where it’s used. What I would like to do is search for something internal to the calendar element regardless of where the calendar element is.

Just as a simplified case, consider the following:

<div class="not-calendar">
    <a href="/not-calendar-link">A Link</a>
</div>
<div class="calendar">
    <a href="/calendar-link">A Link</a>
</div>

Now, I would like to do something along the lines of:

$this->click("//a[text()='A Link']");

But this is ambiguous. I would like to do that same kind of “search” for the A Link text, but only search for such within the div with the class calendar. Keeping in mind that I don’t want a direct XPath to the calendar div because I’m expecting it to show up in different places on many pages. How might I go about doing this? Thank you much!

  • 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-10T04:14:00+00:00Added an answer on June 10, 2026 at 4:14 am

    Xpath is quite powerfull, have you tried to check the documentation?

    //bbb      Selects all bbb elements no matter where they are in the document
    aaa/bbb    Selects all bbb elements that are children of aaa
    aaa//bbb   Selects all bbb elements that are descendant of the aaa element, no matter where they are under the aaa element
    

    The expression you’re looking for: //div[@class='calendar']/a

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

Sidebar

Related Questions

I have this code that should show and hide element outputs according to specific
I have this piece of code: for element in json[referenceElement].keys(): When I run that
I used to have a code that checks any previous element with a corresponding
I have code that adds a pre-determined HTML snippet into a pre-determined <div> element
I have a piece of jQuery code that fills an element on the page
I'm drawing an image to a canvas element. I then have code that depends
I have a td-element which can contain some HTML code, e.g. &lt; . This
I have code that I expect to return the element name, but nothing is
I have the following code that creates a draggable and droppable element/area. And when
I have the following code that populates a select element with values from an

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.