Skip to main content

Locators for Selenium Web Driver

As we already discussed that Selenium Web Driver work only with the Web Application. In every Web Application there are several Web Pages. In each Web pages there are several Web Element.

Now the question is what is the Web Element?

Everything that is showing on Web Page is the Web Element. Web Element is the Text Box, Button, Text Are, Radio Button, Checkbox, Link, Images, Browser Button, Text, iFrame, pop up window, pop up screen, Confirmation Box, Alert Box all are Web Element.

For Locate any element we use two add-ons of firefox

  • FireBug: This is the add-ons of firefox. You can download and install it from here
Automation Testing, FireBug, Locators, Selenium Web Driver,


After install it will show like below snapshot in your Firefox browser
Automation Testing, FireBug,  Locators, Selenium Web Driver,

  • FirePath: This is the add-ons of firefox. You can download and install it from here

Automation Testing,  FirePath, Locators, Selenium Web Driver,

After install it will show like below snapshot in your Firefox browser once you will press F12 button 

Automation Testing, FireBug, FirePath, Locators, Selenium Web Driver,

To locate these Web Element on the Web Page , we need  locators. Selenium Web Driver use 8 locators to locate every Web Element on the Web Page. These locators are
  • Id: In this locator select the element with the @id attribute. 
  • Name: In this locator select the element with the @name attribute. 
  • Linktext: Visible text with link that exactly matches with the provided Text.
  • Partial Linktext: Visible text with link that partially matches with the provided Text.
  • Tag Name: Locate element using Tag Name
  • Class Name: Locate element using Class Name
  • CSS: Locate element using CSS Selectors
  • Xpath: Locate element using XPath expression. 

Comments

Popular posts from this blog

What is API?

In general way, API (Application Programming Interface) is the intermediate software which is useful for two applications to communicate. API is the tool which is used for interaction of two applications. If developer developing any software which have multiple blocks (Modules) than developer use APIs to put them together.

Ad-Hoc Testing

Ad-Hoc Testing is the testing type which is performed without any proper procedure and without any Requirement Specification. Ad-Hoc testing is totally informal testing which have intension to break the application as early as possible and found important defect early.  In Ad-hoc testing tester do not have any test cases so only the users who have very high knowledge regarding the application only they can perform Ad-Hoc Testing.

XPath Expression to locate Web Element

In last article i mentioned you how to locate the Web Element with id, Name, LinkText, Partial LinkText, CSS Selectors, Class Name and Tag Name. We use FireBug add-one to use these 7 locators to locate the Web Element on Web Page. Now we are talking about XPath expression. Which is also a type of Locator. We need FirePath add-ons to use it.