Locators
Mechanism to find elements in a web page
There are 7 ways which we can use to find an element or group of elements in a web page. And they are
Id
Name
Tag name
Link text
Partial link text
CSS Selector
XPath
Id:
If an element has id
attribute then we can use it find the element.
Name:
If an element has name
attribute then we can use it find the element.
Tag name:
We can find an element using it'stagname
.
Link text:
If an element is having tag a
, then we can identify it using the link text of it.
Partial link text:
If an element is having tag a
, then we can identify it using a portion of it's text.
All the above mentioned locator mechanisms are straight forward.
But what if the element doesn't have any unique id, name or link text
Then the last two locators mechanisms help to locate the elements.
We'll be seeing them in the separate sections.
Last updated