2

I am new to Selenium. I heard that in real time we will not use xpaths generated by tools..rather we will write our own. So i decided to learn writing xpaths. Can u please suggest how to practice writing xpaths and are there any tools where we can validate our written xpaths over scripts..

Niels van Reijmersdal
32.7k4 gold badges59 silver badges125 bronze badges
asked May 19, 2015 at 11:14

3 Answers 3

4

you have to install firebug + firepath in mozilla firefox

enter image description here

it will also provide you generated xpath

enter image description here

You can also write the created xpath in the text field and press enter and it will validate the xpath .//*[contains(@placeholder,'Enter your email')]

for creating xpath and locator search on google about locator strategies in selenium

answered May 19, 2015 at 11:37
1

On writing xpaths: a great reference website if you like reading documentation.

On validating xpaths: You need to run the tests and validate they're clicking on and finding the correct elements.

If there's a syntax issue with your locator, the test will fail since whatever XML parser Selenium uses in your language will throw an exception if you have a malformed xpath.

answered May 20, 2015 at 5:21

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.