I would like to match a <button> element with a certain text, which is sometimes closed in another element within the button, eg.:
<div @class="buttonset">
<button>Close</button>
</div>
<div @class="buttonset">
<button>
<span>Close</span>
</button>
</div>
The xpath query //div[@class='modal-buttonset']/button[text()='Cancel'] gives me only result from the highest level.
How to match the text on all levels?
@-- your example confuses markup syntax with XPath syntax. Hopefully that's a question typo, not your actual data.