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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:05:20+00:00 2026-05-14T04:05:20+00:00

I have played for a while writing XPath but am unable to come up

  • 0

I have played for a while writing XPath but am unable to come up with exactly what I want.

I’m trying to write XPath for link(click1 and click2 in code snippet below) based on known text(myidentity in code snippet below). Can someone take a look into and suggest possible solution?

HTML code snippet:

<div class="abc">
  <a onclick="mycontroller.goto('xx','yy'); return false;" href="#">
    <img src="images/controls/inheritance.gif"/>
  </a>
  myidentity
  <span>
    <a onclick="mycontroller.goto('xx','yy'); return false;" href="#">click1</a>
    <a onclick="mycontroller.goto('xx','yy'); return false;" href="#">click2</a>
  </span>
</div>
  • 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-05-14T04:05:21+00:00Added an answer on May 14, 2026 at 4:05 am

    See Macro’s answer – this form should be used.

    //div[text()[contains(., "myidentity")]]/span/a[2]
    

    The following only works with one section of text in the containing div.

    You’ll need to select based on the text containing your identity text.

    Xpath for click1

    //div[contains(text(),"myidentity")]/span/a[1]
    

    Xpath for click2

    //div[contains(text(),"myidentity")]/span/a[2]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a quick server app for something so don't really want to write
I've played with this for quite a while but am at a bit of
I'm writing a simulation of Bananagrams for fun. I want to use concurrency but
I have played for a while with OpenGL on Android on various devices. And
I have played with the idea of using a wiki (MediaWiki) to centralize all
I have played around with smart phone development (windows ce), and it seemed pretty
Right, I have a video ready for it to be played on start up
I have a fairly simple script but something is going wrong and I can't
i have a input tag which is non editable, but some times i need
I want to have generalised email templates. Currently I have multiple email templates with

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.