I would like to better understand the meaning and usefulness of .
before /h3
.
I looked for a website with a tutorial, but I couldn't find one explaining its use.
//div[./h3/a[text()='Home']]
I would like to better understand the meaning and usefulness of .
before /h3
.
I looked for a website with a tutorial, but I couldn't find one explaining its use.
//div[./h3/a[text()='Home']]
The difference is that of relative vs absolute selection.
Disregarding the /a[text()='Home']
common to both cases:
//div[./h3]
selects all div
elements that have an h3
child element.//div[h3]
.//div[/h3]
selects all div
elements provided that the document root element is h3
.Absolute tests such as /h3
within a predicate ([/h3]
) are relatively uncommon.