Basic To Advanced Selenium Java Full Course - Session 9 - Handling Dynamic Elements using XPath

Опубликовано: 28 Май 2022
на канале: QASCRIPT
1,185
10

Handling Dynamic Elements using XPath:
Contains - Can be used when there is a pattern in attribute values
It has the ability to find element with partial text
OR/AND - Used to identify elements with multiple attributes
Starts With - Matches the starting text of the attribute to find the element
Text - Matches the exact text to find the element
Index - Locates the element using index

XPath Axes Methods:
Following: Selects everything in the document after the closing tag of the current node
Ancestor: Selects all ancestors (parent or grandparent) of the current node
Child: Selects all children of the current node
Preceding: Selects all nodes that appear before current node
Following sibling: Selects all siblings after the current node
Parent: Selects the parent of the current node
Descendant: Select all descendants (children or grandchildren) of the current node

Wait Methods:
Implicit Wait:
WebDriver waits for a certain duration of time until all the elements on the page are loaded
Useful when certain elements on the webpage are not available immediately and need some time to load
Explicit Wait:
WebDriver will wait for a specific element on the page until the given condition is satisfied
Useful if one of the element take longer time to load compared to other elements on the page
Fluent Wait:
It tells the WebDriver to wait for a condition, as well as the frequency with which to check the condition
PageLoad Timeout: Sets the amount of time to wait for a page load to complete before throwing an error
SetScript Timeout: Sets the amount of time to wait for an asynchronous script to finish execution before throwing an error
Wait: Causes the current thread to wait until it is awakened, typically by being notified or interrupted