Notice that its HTML tag is “input” and its class is “inputtext. Selenium IDE should be able to access the Phone text box correctly. Navigate to Mercury Tours Registration page and inspect the Phone text box. Use this when you know link text used within an anchor tag. The text locator looks for elements with that contain the supplied text.

Uploader: Akinosida
Date Added: 1 November 2005
File Size: 62.25 Mb
Operating Systems: Windows NT/2000/XP/2003/2003/7/8/10 MacOS 10/X
Downloads: 71935
Price: Free* [*Free Regsitration Required]

Using Firebug, examine the “Email or Phone” text box. Use this when you know id attribute of an element.

In certain Selenium Automation Tests, there is a need to control keyboard or We hope that this Selenium tutorial would have helped you in doing that.

If your application uses webdirver lot of CSS, then your developers are likely very familiar with the concept and can help you devise CSS Selectors to find any element on the page. Notice that the form containing it has no ID and name attributes.

Element Locator – Chrome Web Store

She writes here about Manual Testing and Automation Testing. It can access almost any element, even those without class, name, or id elment. Alternatively, you can use the element’s name instead of its index and obtain the same result.


Selenium IDE should be able to access the Phone text box correctly.

However, it gets tough at times to accurately identify a web UI element. Caution As a general rule, keep in mind that if a locator matches several elements, only the first one will be effectively used by Selenium.

Locating Hyperlinks by Link Text 4. Selenium IDE should be able to identify the Economy class radio button correctly. XPath locators are robust and reliable.

A well-written Lpcators can be very robust, but a poor XPath can be fragile — locatprs that it may break when the application changes. Selenium provides the following methods to locate elements in a page:. Click on the Find button. Each element is indexed with a number starting from 0 just like an array You specify which element you wish to access by putting its index number into the square brackets in getElementsByName’s syntax below.

Each id is supposed to be unique so no chance of matching several elements. Refer to the image below.

Locators can be classified into two categories: We use above mentioned method to locate elements but the locator part will be replaced with the locator names. In this tutorial, we will learn How to deal with file uploads and downloads.

Element Locator

A web developer must use a proper and consistent locator scheme for a website. First, make sure that you are logged off from Mercury Tours. With this strategy, the first element elemennt the link text value matching the location will be returned. Make sure that the test application is running: By finding a nearby element with an id or name attribute ideally a parent element you can locate your target element based on the relationship.


Selenium Tutorial: Locators

We will access the ‘Email or Phone’ text box first. Valid XPath locators can be:. XPath is designed to allow the navigation of XML documents, with the purpose of selecting individual elements, attributes, or some other part of an XML document for specific processing. In general, field names are unique to the form, but not always. Take note that when multiple elements wdbdriver the same HTML tag and name, only the first element in source code will be recognized. There are also a couple of very useful Add-ons that can assist in discovering the XPath of an element:.