Though we have practiced many ways of writing XPath statements to locate the elements, its not always required to write the XPath statements. In most of the cases we take the help of 'Firepath' tab under 'FireBug' option.
We are going to use our knowledge of writing the XPath statements without the help of 'Firepath', if and only if the 'XPath' statement returned by the 'Firepath' is:
- Not Working (We are going to manually write the XPath statement in this case)
- Not optimized (We are going to edit the XPath statement returned by the 'Firepath')
Most Regular way of Finding the XPath for Elements:
1. Launch Firefox and navigate to any site say www.google.com
2. Click on the FireBug icon on the top right side of the page as shown below:
3. Ensure that FireBug interface along with 'FirePath' tab is displayed on the bottom of the page as shown below:
4. Click on the 'Inspect Element' FireBug option and select any UI element say 'Google Logo' as shown below:
5. Click on the 'Firepath' tab to find out the Xpath property value of the inspected element (i.e. Google Logo in this example) as shown below:
6. Ensure that 'Xpath' property value of the selected UI element (i.e. Google Logo) is displayed by default as shown below:
2. Click on the FireBug icon on the top right side of the page as shown below:
3. Ensure that FireBug interface along with 'FirePath' tab is displayed on the bottom of the page as shown below:
5. Click on the 'Firepath' tab to find out the Xpath property value of the inspected element (i.e. Google Logo in this example) as shown below:
6. Ensure that 'Xpath' property value of the selected UI element (i.e. Google Logo) is displayed by default as shown below:
No comments:
Post a Comment