Title: Different ways to find XPath - Selenium Webdriver with Java Tutorials
?Blog: www.amarindaz.com
?FB page: / amarindaz
?Youtube subscription: https://goo.gl/J2453w ??
=========================
Subscribe and Stay Update!
?Join our Automation testing newsletter and get updates delivered to your email- https://goo.gl/8ysm1X
==========================
What is XPath?
XPath is used to find the location of any Webelement on a webpage using HTML DOM structure
======================
What is Absolute xpath?
Absolute XPath starts with the root node or a forward slash (/).
The advantage of using absolute is, it identifies the element very fast.
Disadvantage: if some other tag or element added in between, then this path will no longer work.
Example:
html/head/body/table/tbody/tr/th
======================
What is Relative Xpath?
A relative Xpath is one where the path starts from the middle of the HTML DOM structure.
It doesn't need to start from the root node.
It starts with Double forward slash(//)
It can search the element anywhere at the webpage.
Example:
//*[@class=‘google']
=======================
Difference between Single slash and Double slash
A single slash ‘/’ locate element immediately inside its parent element.
A double slash ‘//’ locate any child or any grand-child element inside the parent element.
======================
A different approach to find Relative Xpath:
Basic XPath
Contains()
OR & AND
Starts-with
Text()
By Index
XPath axes methods
For more details, please watch the video
Don't forget to subscribe! https://goo.gl/J2453w
💼 To Hire Me 👉 https://fwd.cx/WLGgpTiZW5HK
Checkout my app 👉 https://www.myfreshtools.com