Mastering XPATH for Selenium Testers [With Locator CheatSheet]

  • XPath can be used to navigate through elements and attributes in an XML document.
  • XPath is a syntax for defining parts of an XML document
  • XPath uses path expressions to navigate in XML documents
  • Mastering XPath/ CSS is essential for the Selenium test automation engineers to locate dynamic web elements, elements without ids or names, and elements with dynamic ids and names.
  • Absolute XPath starts with the root break when minor structural changes lengthier and hence they are not readable /html/body/header/div/a /html/body/header/div/a
  • Relative Xpath Relative XPaths are started with two forward slashes ‘// locating elements with respect to an element with known (solid) XPath //form/div[@id =’divUsername’]/input Absolute XPaths are faster than the relative XPaths

--

--

--

Lead Automation Expert | Blogger |Health Enthusiast https://www.youtube.com/c/thetestingacademy

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

What happens when you type ls *.c in the shell?

How to make a subscription service in Webflow in 1 hour

APEX Network blockchain development progress

Laravel and Vue: Creating a Portfolio website with a CRUD admin panel

Hacking some Websites are just a Piece of Cake !

Outstand Your Hybrid App Development With Ionic 2

Setting a default value for the PhoneFactor country drop-down in Azure AD B2C

Project Manager Days are Numbered

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pramod Dutta

Pramod Dutta

Lead Automation Expert | Blogger |Health Enthusiast https://www.youtube.com/c/thetestingacademy

More from Medium

Selenium with JavaScript: How to run Automation Tests

Increasing Test Coverage with Hybrid Automation Frameworks

Assertions in Selenium WebDriver

Automation Testing with Playwright and Java Script — Part I (Set Up)