DEV Community

Cover image for Mastering XPATH for Selenium Testers [With Locator CheatSheet].
Pramod Dutta
Pramod Dutta

Posted on • Updated on

Mastering XPATH for Selenium Testers [With Locator CheatSheet].

✅Join us - https://sendfox.com/thetestingacademy

In this video, We are discussing XPath in selenium webdriver and we are going to master them one by one.

✅ What is XPath?

  • 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.

Mastering XPATH for Selenium Testers

✅ Why do we need to learn many XPath?
Locating elements with partially static attribute values
Locating elements with respect to a known element
Locating elements without attributes or without unique attributes
XPath can do bidirectional navigation (Going forward and backward)

✅ Types of XPath

  • 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 a element with known (solid) XPath //form/div[@id =’divUsername’]/input Absolute XPaths are faster than the relative XPaths

🚀 Day 11 Task : Mastering XPATH for Selenium Testers
🚀 Thread : https://scrolltest.com/automation/day11
🚀 All Task List : https://scrolltest.com/automation/task
🚀 Watch Full Playlist : https://scrolltest.com/automation/playlist

--
Be sure to subscribe for more videos like this!

 TheTestingAcademy

Latest comments (0)