1. Launch Selenium IDE from the Firefox Browser -> Tools Menu
2. Ensure that the record option on the Selenium IDE is turned on by default
3. Open http://book.theautomatedtester.co.uk in the Firefox Browser
4. Click on the 'Chapter2' link as shown below:
10. Ensure that you have already installed FirePath Addon for FireFire Browser, if not go through the my earlier Post# 5 Install FirePath Addon for FireFox to install it
11. And also go through my earlier Post# 6 How to use Firepath if you dont know how to use Firepath
12. Click on 'Firepath' tab on the FireBug options Pane as shown below:
13. Repeat Steps 6,7 and Observe that Xpath locator of the inspected text element is displayed as shown below:
14. Copy the displayed XPath value in the above step
15. Click on the blank space after the existing commands in the Selenium IDE as shown below:
16. Paste the copied XPath locator (i.e. Copied in the step 14) into the Target Text box on the Selenium IDE as shown below: (i.e. paste xpath=[CopiedXpath] )
17. Click on the 'Find' button beside the Target text box to find out whether the inspected text element is getting highlighted in yellow color as shown below: (i.e If the inspected text is getting highlighted in Yellow color on clicking the 'Find' button on the Selenium IDE, it means that selenium is able to find the inspected link using the XPath Locator [ i.e. html/body/div[1] in this example ] )
Example of Selenium RC Automation Test Using xpath=html/body/div[1] locator:
assertTrue(object1.isElementPresent("xpath=html/body.div[1]"));
Before concluding this post, I would like to let you know that:
In my experience, I've found that most of the UI elements are identified by using the XPath locators. As in most of the cases developers have not put ID or Name properties for the UI elements, in this case XPath will be the solution. As Xpath locators can identify the static and dynamic UI elements and also XPath flexibility allows us to identify the elements that cant be identified by other locators.
In my experience, I've found that most of the UI elements are identified by using the XPath locators. As in most of the cases developers have not put ID or Name properties for the UI elements, in this case XPath will be the solution. As Xpath locators can identify the static and dynamic UI elements and also XPath flexibility allows us to identify the elements that cant be identified by other locators.
Please comment below to feedback or ask questions.
How to identify the elements using the 'CSS' locator will be explained in the next post.
How to identify the elements using the 'CSS' locator will be explained in the next post.
No comments:
Post a Comment