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

16 Replies, 1438 Views

For partial matches, `contains()` is your best bet, but watch out for whitespace!

Sometimes `normalize-space()` helps: `//div[contains(normalize-space(), 'error')]`.

If you’re scraping, [Scrapy](https://scrapy.org/) has built-in XPath support and handles messy HTML way better than raw XPath.

Messages In This Thread



Users browsing this thread: 1 Guest(s)