I would like to query elements by text or partial text match without a restriction on element type. This is useful in cucumber steps such as /^I click the "(.*)" button$/, where the button could be implemented with an <a>, <button> or <input> tag.
I also may wish to look for text on a page e.g. "You have been logged out", but this could be embedded in almost any element, in which case it is not practical to enumerate all possible tags and search for the text with each one.
From the docs it doesn't look like this is possible without specifying an element type, is there a way? Can there be one?
This is really high in Google results, so here's a working example:
browser.getText("//*[contains(text(),'Hello')]")
Thanks!
*=some text is working for me (v4.13.2).
@christian-bromann why were you not sure that it would work? Was it related to the version of Webdriverio used?