filmov
tv
Locatey by Xpath axes approach Selenium Webdriver with Java Tutorials

Показать описание
Title: XPath axes approach in selenium -Selenium Webdriver with Java Tutorials
=========================
Subscribe and Stay Update!
==========================
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 on the webpage.
Example:
=======================
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
XPath Axes Methods::
It used to find the complex or dynamic elements
1)Ancestor
2)Ancestor or self
3)Attribute
4)Child
5)Descendant
6)Descendant or self
7)following
8)following sibling
9)Namespace
10)Parent
11)Preceding
12)Preceding sibling
13)Self
Ancestor lets you select any Parent and Grandparent of the current node.
Ancestor-or-self lets you select any Parent and Grandparent of the current node including the current node
The child returns all the children in the current node.
Descendant lets you select Children and Grandchildren of the current node.
Descendant or self-lets you select Children and Grandchildren of the current node including current node
Following returns all in the document after the closing tag of the current node.
Following-sibling returns all the sibling after the closing tag of the current node.
Parent returns the parent of the current node.
Preceding returns all in the document before the current node
Preceding-sibling returns all the sibling before the current node
Self-returns the current node
For more details, please watch the video
=========================
Subscribe and Stay Update!
==========================
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 on the webpage.
Example:
=======================
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
XPath Axes Methods::
It used to find the complex or dynamic elements
1)Ancestor
2)Ancestor or self
3)Attribute
4)Child
5)Descendant
6)Descendant or self
7)following
8)following sibling
9)Namespace
10)Parent
11)Preceding
12)Preceding sibling
13)Self
Ancestor lets you select any Parent and Grandparent of the current node.
Ancestor-or-self lets you select any Parent and Grandparent of the current node including the current node
The child returns all the children in the current node.
Descendant lets you select Children and Grandchildren of the current node.
Descendant or self-lets you select Children and Grandchildren of the current node including current node
Following returns all in the document after the closing tag of the current node.
Following-sibling returns all the sibling after the closing tag of the current node.
Parent returns the parent of the current node.
Preceding returns all in the document before the current node
Preceding-sibling returns all the sibling before the current node
Self-returns the current node
For more details, please watch the video