0

Can anybody please tell me what is the difference between // and //* in xpath. Is there any difference?

3 Answers 3

2

"//div[@id='something']" - will find the div with id something.

"//*[@id='something']" - will find any tag with id something.

Sign up to request clarification or add additional context in comments.

Comments

0

Source-Xpath Syntax

//* Selects all elements in the document

// Selects nodes in the document from the current node that match the selection no matter where they are

2 Comments

//*[@id=’social-media’] Does that means look for id='social-media' on every element.
That's correct.It would match the condition in all the tags and if you want to search in the current node then you have to use something like //div[@id=’social-media’]
0

//div[@id='xyz'] means find all div-s with the mentioned if ,// means that it is an relative Xpath and not an absolute one.

//*[@id='xyz'] find all element with the mentioned id not just div.Again it is an Relative Xpath as it starts with //

Comments

Your Answer

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.