Search code examples
c#xpathhtml-agility-pack

Invalid token while executing xpath


I am getting an invalid token error while trying to select a node using HtmlAgilityPack.

The Xpath I have used is :

"//article[contains(@class, 'product-buy')]/div[@class='product-price-wrapper']/div[@class='price']​"

Not sure which is the invalid token and how can I solve this

I tried some other xpaths with ' and is working fine


Solution

  • There is a character between the last bracket and the closing quote. On this web page it is a Unicode Character 'ZERO WIDTH SPACE' (U+200B). You can tell by trying to arrow through the string in an editor.