3 ms·
There's not "an" XPath for an element, as XPath describes the route you take from the root of a document to the element in question. The correct route for your
by garethadams 13y ago
There's not "an" XPath for an element, as XPath describes the route you take from the root of a document to the element in question. The correct route for your situation depends on your use case.
Describing an element as "the first child of the fifth child of the second child of the first child of the eighth child of the second child of HTML" is as much the right path to an element as if you described the way to your house as "Walk past the park then walk past the bus stop then walk past the hardware store then walk past the butchers then turn left then walk past the pizza shop then walk past the library"
- callmeed 13y agoI'm aware what XPath is/does. And I'm not disagreeing with you–I'm only saying Chrome has this feature. I don't know what route they choose for you but I know they don't always work in tools that parse (HT/X)ML. Here's a screenshot in case you don't believe me: http://imgur.com/9FZSMSt http://imgur.com/9FZSMSt The XPath Chrome returns for this page is: //*[@id="details"]/article/table[1]