Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

173
Views
selenium unable to get CORRECT location of anchor in paragraph

First person to answer this (I don't believe there is an answer) gets a free dinner!

I am trying to locate the coordinates of a link (text) in a paragraph to move the mouse to that link to perform a hardware click (not a javascript click or click via selenium).

<p>for full automatic work you need to read about <code>DesiredCapabilities</code> as this: <a href="https://stackoverflow.com/questions/23510816/how-to-handle-downloading-a-file-in-selenium-webdriver">How to handle downloading a file in selenium webdriver?</a></p>

Doesn't matter really, the coordinates returned are always that of the enclosing <p>

Look here: https://sqa.stackexchange.com/questions/2197/how-to-download-a-file-using-seleniums-webdriver

To see the above code on page, look for the text How to handle downloading a file in selenium webdriver?

Inspect it, play around with it, no matter how I try to get at the anchor location, I can't seem to find a way to get to it. It's always the paragraph bounding rectangle.

Inspecting in Firefox it will highlight the text (but how to get to that programmatically?)

Seleniun 'finds' the anchor fine, i've tried by text, xpath, css, all find the same tag, inside the <p> and all return the x,y of the <p>.

I've tried a range to count words and calculate the position, but getting the text returns the text of the anchor, not the enclosing paragraph.

thanks in advance!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!