79119776

Date: 2024-10-23 21:37:10
Score: 1
Natty:
Report link

As Conal said, XPath expressions generated by the browser using the Developer Tools (F12) are not best nor optimal. You can try these as a last resource for your project. Using an Xpath expression generated on your own it will benefit your code to have a better maintainability.

As the DOM structure (HTML tree-like code for the page) is subject to frequent changes in the future, having optimal Xpath (based on Text, Objects or Classes Names) will withstand your code to future changes. Using XPath expressions generated by the browser, will result in that your Xpath predicate will stop working.

In regards what Xpath expression for your page. You can use this one:

//span[contains(@class,"currentVersion")]

Check this screenshot to get more details:

enter image description here

Try to learn more about Xpath, here there are 2 resources:

https://intellipaat.com/blog/xpath-in-selenium

https://fifithecat.medium.com/xpath-example-73bf66c2377c

Reasons:
  • Blacklisted phrase (1): regards
  • Blacklisted phrase (0.5): medium.com
  • Whitelisted phrase (-1.5): You can use
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Carlos Gongora