Selenium Full Course using Java | Locator | Dynamic xpath | Click| Clear | Send Keys | Part 2 |

Опубликовано: 07 Май 2026
на канале: AutomationWithArnab
210
2

In this video, I have discussed starting your automation journey using selenium and java.
WHAT is XPATH ?
XPath in Selenium is an XML path used for navigation through the HTML structure of the page. It is a syntax or language for finding any element on a web page using XML path expression. XPath can be used for both HTML and XML documents to find the location of any element on a webpage using HTML DOM structure.
Syntax of XPATH
Xpath=//tagname[@attribute='value']
// : Select the current node.
Tagname: Tagname of the particular node.
@: Select attribute.
Attribute: Attribute name of the node.
Value: Value of the attribute.
Different Type of XPATH
1) Absolute XPath
2) Relative XPath
How to write Relative XPATH?
A.Basic XPATH
//tagName[@attributeName=‘value’] or //*[@attributeName=‘value’]
B. Contains
// Xpath=//*[contains(@attr,'substring')] or Xpath=//*[contains(text(),‘string')] or
C. OR & AND
Xpath=//*[@attr=‘value' or @attr=‘value'] & Xpath=//*[@attr=‘value' and @attr=‘value']
D. starts-with
Xpath=//tagName[starts-with(@attr,‘value')] or Xpath=//*[starts-with(@attr,‘value')]
E. Text() function
Xpath = //*[text()=’value’] or Xpath = //tagName[text()=’value’]

Xpath Methods are used to find dynamic or complex elements in a webpage.
Following : Xpath=//*[@ attr =‘value']/following::tagName
Ancestor : Xpath=//*[@ attr =‘value']/ancestor::tagName
Child : Xpath=//*[@ attr =‘value']/child::tagName
Preceding : Xpath=//*[@ attr =' value ']/preceding::tagName
Following-Sibling : xpath=//*[@ attr =' value ']/following-sibling::tagName
Parent : Xpath=//*[@attr=' value ']/parent::tagName
Self : Xpath =//*[@ attr =' value']/self::tagName
Descendants : Xpath=//*[@ attr =' value']/descendant::tagName

Part 1 :    • Selenium Full Course using Java |  WebDriv...