How Selenium identifies the objects Software testing tutorials for beginners 4
Software testing tutorials for beginners How Selenium identifies the objects?
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 different types of locators.Here explaining they are widely used while automating the test cases using Selenium.
Software testing tutorials for beginners 1:
1. id = id – By default Selenium IDE takes “id” as Locator
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.
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 different types of locators.Here explaining they are widely used while automating the test cases using Selenium.
Software testing tutorials for beginners 1:
1. id = id – By default Selenium IDE takes “id” as Locator
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.
Software testing tutorials for beginners 2:
2. name = name (Second locator)
We will do the following steps to understand how exactly Selenium identifies the objects:
1. Start Selenium IDE from Tools menu of the browser
2. Login to sample application – Sugar CRM
3. Click on Accounts tab
4. Click on Create Account link
5. Now Create Account Page gets displayed
Selenium IDE has recorded all these steps. In the following pictures all the steps above can be seen.
2. name = name (Second locator)
We will do the following steps to understand how exactly Selenium identifies the objects:
1. Start Selenium IDE from Tools menu of the browser
2. Login to sample application – Sugar CRM
3. Click on Accounts tab
4. Click on Create Account link
5. Now Create Account Page gets displayed
Selenium IDE has recorded all these steps. In the following pictures all the steps above can be seen.
Software testing tutorials for beginners 3:
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.
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.
Software testing tutorials for beginners 4:
4. link=link text (in HTML source we can located this using “href” tag)
4. link=link text (in HTML source we can located this using “href” tag)
Software testing tutorials for beginners questions
What are the advantage and features of Selenium IDE?
1. Intelligent field selection will use IDs, names, or XPath as needed
2. It is a record & playback tool and the script format can be written in various languages including
C#, Java, PERL, Python, PHP, HTML
3. Auto complete for all common Selenium commands
4. Debug and set breakpoints
5. Option to automatically assert the title of every page
6. Support for Selenium user-extensions.js file
1. Intelligent field selection will use IDs, names, or XPath as needed
2. It is a record & playback tool and the script format can be written in various languages including
C#, Java, PERL, Python, PHP, HTML
3. Auto complete for all common Selenium commands
4. Debug and set breakpoints
5. Option to automatically assert the title of every page
6. Support for Selenium user-extensions.js file