Level2

Xpath in Selenium

Xpath in Selenium

Level2, Selenium
What is XPath : XPath (XML path) is the language for nodes in an XML document. Since many browsers support XHTML, we can use XPath to find items on web pages. XPath helps in finding direction of element through nodes and its attributes. in HTML pages.   Syntax of XPath:   Using tag and attributes It is possible to locate a specific web element with its HTML tag, its attributes such as Id, name, class, title, value, href, src etc., and their corresponding values. Syntax: "//tagName[@attribute='value']"; Identifies the element pointed by the XPath. ‘//’ identifies the specified node and ‘@’ symbol is used to select the specified attribute which matches the given value. //input[@name='FirstName'] //input[@id='abc']   Xpath with Index: By providing