han
13 years agoContributor
xPath on text
Having problem using the text of the html element to grep on in an EvaluateXPath.
I have tried the following (and they work in Chrome Developer Tools ):
I have tried the following (and they work in Chrome Developer Tools ):
- //*[text()='Text']
- //*[contains(.,'Text')]
- //*[.='Text']
- //*[text()[contains(.,'Text')]]
How should the xPath be written to work in TC?
Hi Håkan,
I've reproduced the issue and filed a bug report for the developers to look into. Thanks for bringing this to our attention.
As a workaround, you can use the Page.FindChild, Page.FindAllChildren or Page.NativeWebObject.Find method for the search. For example, instead of the //*[text()='Text'] XPath search, you can use page.FindAllChildren("contentText", "*Text*", 100).
However, if you need a patch for this, please open a support ticket and refer to this thread.