How can I use XPath to find elements with 'like text' matching? or What's the best way to write XPath

16 Replies, 1452 Views

Dude, xpath like text queries can be a pain when dealing with nested elements.

I usually go with `//*[contains(translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'error')]` if case sensitivity is an issue.

Also, Chrome’s DevTools lets you test XPath right in the console—just hit `$x("your_xpath")`.

Messages In This Thread



Users browsing this thread: 1 Guest(s)