I am running the following query:
//div[@class="review-list"]//div[@class="review review--with-sidebar"]//div[@class="review-content"]/p/string(.)
I get the following error:
lxml.etree.XPathEvalError: Invalid expression
However, if I use the following notation:
//div[@class="review-list"]//div[@class="review review--with-sidebar"]//div[@class="review-content"]/p/text()
All is well.
I assume the issue is with the use of the string(.) notation, but when I test it here it comes up fine, so I'm assuming its valid syntax.
I'm essentially running the following code:
from lxml import html
tree = html.fromstring(PAGE_CONTENT)
results = tree.xpath(QUERY)
Is there an alternative method I could be using that will allow the use of expressions like this? string-join seems to cause similar issues.