Thursday 23 January 2014

Object Identification in Selenium IDE


For most applications, easily use the built in Selenium IDE in Firefox
In Firefox, click on Tools>Selenium IDE.
Make sure the red record button is in the “Now recording..” mode.
Notice how the Selenium IDE automatically recognizes what information (id-tools) to use to identify the Select tool dropdown.
Click on the select command to highlight it, then click the “FIND’” button.
we will understand how Selenium identifies the objects on the Application Under Test.
Every page is HTML. While recording, when we click on some element, IDE selects a particular property of that element that is unique in that page. Hence it is able to perform the operations

To identify the objects such as Links, Buttons, Edit boxes, Drop downs, etc on the application Selenium uses a concept called “Locators”.  There are around 8 different types of locators.  Out of them, I will be explaining only four as they are widely used while automating the test cases using Selenium.

Every Web Page will be having some HTML Source code.  This can be viewed using “View –> Page Source / View source” on the browser. In the following picture we can see “id” attribute of a HTML tag is used as a locator to identify an object.


ü  Login to sample application
ü  Click on Accounts tab
ü  Click on Create Account link
ü  Now Create Account Page gets displayed
ü  Selenium IDE has recorded all these steps
3)  xpath = xpathExpression.  Xpath is used as a Locator to identify an object.  This is an expression which is formed by combining various HTML tags
4)   link=link text (in HTML source we can located this using “href” tag)

No comments:

Post a Comment