Various kinds of Locators

Locators in Selenium

Selenium uses locators to find and match the elements of the web page that it requires connecting to. Locators will be the lifeblood of the tests. the right locator ensures the testing is faster, reliable or lower maintenance releases. If lucky enough to be working with unique IDs and Classes, they’re usually all set. But occasions choosing a right locator will become a nightmare. It can be a real obstacle to verify right locators to perform want Various kinds of Locators.

Various kinds of Locators

A couple of explicit locators. id, name, identifier, dom, XPath, website link, CSS, UI that Selenium’s directions support. I am going to explain few most significant locators to avoid over dose and any dilemma.

ID Locator

Ids will be the most preferred way to find elements on a full page. Each identification to be unique making Ids a faster and reliable to find elements.
The first element with the id attribute value matching the location delivered. If no component has a coordinating id feature, a NoSuchElementException raised.
This is a great locator, it is not realistic for many objects on a full page to get ids. In some cases designers make it having non-unique ids on a page. auto-generate the Ids in both circumstances avoided.

Name Locator

That competent way to locate a component with the name attribute after Ids. it next preference but moreover, Ids, name features need not be unique in a full-page.
 The first factor with the name attribute value matching the location will come back. If no aspect has a matching name attribute, a NoSuchElementException increased.

Identifier-Locator

This selects the element with the given @id attribute. If no match found, then it attempts to select the first component whose @name feature is Id.

Link Locator

With this, you will get components of “a” tags(Link) with the link names. Use this when you understand link word used in an anchor tag.

DOM Locator

The DOM strategy works by locating elements. that suit the JavaScript manifestation referring to a component in the DOM of the page. DOM means Document Thing Model. DOM is the convention for representing items in HTML documents.

XPath Locator

While DOM the regarded standard for navigation through an HTML factor tree. XPath is the standard navigation tool for XML; and an HTML report is also an XML file (XHTML). XPath used everywhere go where there is XML.

Various kinds of Locators

We provide Various kinds of Locators in real time training experts. We offer selenium training in hyderabad on real time project training.

Save

Leave a comment