I am having a problem selecting nodes by attribute when the attributes contains more than one word. For example:
<div class="atag btag" />
This is my xpath expression:
//*[@class='atag']
The expression works with
<div class="atag" />
but not for the previous example. How can I select the <div>
?
div.atag
ordiv.btag
. Super simple, not string matching, and WAY faster (and better supported in browsers). XPath (against HTML) should be relegated to what it's useful for... finding elements by contained text and for DOM navigation. – Watchband