Wednesday, 5 February 2020

Locators in Selenium


There are eight locators in selenium. We can priorities the locators as below:

1.id

2.cssSelector

3.xpath

4.name

5.className

6.linkText

7.partialLinkText

8.tagName


Xpath are of two types

Absolute XPath

Eg: html/body/div[1]/section/div[1]/div/div/div/div[1]/div/div/div/div/div[3]/div[1]/div/h4[1]/b

Relative XPath

Eg: //*[@class='featured-box']//*[text()='Testing']

Absolute xpath should not be used, only Relative Xpath should be used in the selenium scripting

No comments:

Post a Comment