What is the difference between .// and //* in XPath?

0
0

While finding the relative XPath via Firebug : it creates like

  1. .//*[@id='Passwd']——— what if we dont use dot at the start what it signifies?

  2. Just add //* in the Xpath —
    it highlights — various page elements ———- what does it signify?

Below are XPaths for Gmail password fields. What is significance of * ?

  • .//*[@id='Passwd']

  • //child::input[@type='password']

  • You must to post comments
0
0

These expressions all select different nodesets:

.//*[@id=’Passwd’]

The ‘.’ at the beginning means, that the current processing starts at the current node. The ‘*’ selects all element nodes descending from this current node with the @id-attribute-value equal to ‘Passwd’.

What if we don’t use dot at the start what it signifies?

Then you’d select all element nodes with an @id-attribute-value equal to ‘Passwd’ in the whole document.

Just add //* in the XPath — it highlights — various page elements

This would select all element nodes in the whole document.

Below mentioned : XPatht’s for Gmail Password field are true what is significance of * ?

.//*[@id='Passwd']

This would select all element nodes descending from the current node which @id-attribute-value is equal to ‘Passwd’.

//child::input[@type=’password’]

This would select all child-element nodes named input which @type-attribute-values are equal to ‘password’. The child:: axis prefix may be omitted, because it is the default behaviour.

The syntax of choosing the appropriate expression is explained here at w3school.com.

And the Axes(current point in processing) are explained here at another w3school.com page.

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website