Locator is a command that tells Selenium IDE/Webdriver which GUI elements needs to operate on (Say Text Box, Buttons, Check Boxes etc). Locators are the basic building blocks of a web page. A web developer must use a proper and consistent locator scheme for a website. Also, a test engineer must choose the correct locator strategy to automate the online workflows.

The following are the locators strategies included in Selenium:

  • Id
  • Name
  • Link Text
  • Partial Link Text
  • XPath
  • Class Name
  • Tag Name
  • Class Name
  1. source link Id: To select the element with a specified @id attribute

It is a unique reference for a web object that the developer sets while writing the code. Ideally, the ID should not repeat on a page, but the browsers do allow exceptions to this rule. The ID is no doubt the best locator to use in Selenium. Still, if it belongs to an HTML table, then it’s possible that it would change or disappear from the list. Hence, you need to put in a more advanced locator technique.

From the above Screenshot, you can find the element using the locator: ID



2.  bande son rencontre avec joe black Name:  To select the first element with the specified @name attribute.

Every form has input fields with unique names. Names are unique most of the times. However, a field name locator is the best choice for testing a login form. But when you have multiple login types on the same page then you should use locators with a different scheme.

From the above Screenshot, you can find the element using the locator: Name


3.  http://arbhojpuri.com/?b=where-to-get-cheapest-cialis Link Text: To Select The link element which contains the matching text.

driver.findElement(By.linkText(“Create Account”));

4. binary trade web service Partial  http://90daygreatbody.com/?kuid=iqoption-postepay&de9=75 Link Text: To Select The link element which contains the matching text.

driver.findElement(By.partialLinkText(“Create Account”));

5. http://salpasafarit.fi/?kalimo=euro-analiz-forex&393=53 Xpath: XPath is the language used when locating XML (Extensible Markup Language) nodes. Since HTML can be thought of as an implementation of XML, we can also use XPath in locating HTML elements.

Advantage citas en linea del imss : It can access almost any element, even those without class, name, or id attributes.

Fortunately, Firebug can automatically generate XPath locators. In the following example, we will access an image that cannot possibly be accessed through the methods we discussed earlier.

We can classify XPaths in the following two groups.

It starts from the root element within the web page or part of the page and goes to identify the target element.

Path start with the node of our choice


6. trading opzioni Tag Name: To Find The Element Using Its HTML Tag.

Select select = new Select(driver.findElement(By.tagname(“select”)));


7. citas de igualdad entre hombres y mujeres ClassName: The CSS class locator uses a specific class attribute to get to the first element on a web page. It is useful for items that own a unique style.


8. http://eren.es/?esrof=modelos-economicos-alternativos-y-dise%C3%B1o-del-sistema-de-comercio-justo&302=fa Css Locator:

CSS Selectors are no different than the XPaths. But they are resilient and powerful. Unlike the XPath, they aren’t dependent on the DOM structure. They can help you perform actions which are difficult to do with XPath.


Categories: Selenium


What I love doing: Identifying and analyzing business problems with technology, convert Traditional testing methodologies to Automation testing using emerging testing technologies.

Leave a Reply

Your email address will not be published. Required fields are marked *