Skip to content

Tag: xpath

How to escape a sup tag in xpath selector

I want to extract the text content from the below HTML tag, but the <sup> tag is preventing me from getting the desired text. The text I want to extract is simply (4:6, 6:7). how can I extract this text at the same time escaping the <sup> tag. I tried this “//p/text()”, but I am only g…

Parse property page URLs using xpath

I am trying to parse the main property page https://www.realtyatlas.co.za/search?areas%5B0%5D%5Btown%5D=Bellville&status=For%20Sale, more precisely I would like to extract the href from attribute class that is here, and make a follow link: However all the combinations I have tried result in None. I am als…

How to use Array.from with a XPathResult?

When I use querySelectorAll, I can find 138 td nodes in my sample document. When I do the same with XPath, I get no result: Although there is at least one match: The problem seems to be that Array.from can not iterate over a XPathResult. Even this returns 0: How to make a XPathResult suitable for Array.from? …

Get element’s xpath in javascript

I am developing in javascript and I would need to get the xpath of the element clicked. I know that in order to get the id we can do : How could I do to get the xpath ? Regards. Answer There are many ways to access an element with XPath. For example you can access it by node name