Karate UI- how to search for locator text containing an apostrophe (single quote)?

Viewed 271

For a div that contains the text "What's New", I tried using * waitFor("//div[normalize-space()=\"What's New\"]") with an xpath that successfully locates an element in the dev tools console, but my Karate test failed to locate the same element. I can't find any variations on xpath or KarateUI locator syntax that successfully locate the element.

1 Answers

Yes you can't mix single-quotes like that, because it has to be run as JS in the browser. You are most welcome to contribute code to improve this in Karate.

Try to work-around using alternates:

* waitFor("{^div}s New")
Related