Get XPATH of a specified node in JavaScript
Reported by
suguru.i...@gmail.com,
May 10 2018
|
|||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36 Steps to reproduce the problem: In DevTool, I can get an XPATH of a node only in DevTools GUI. What is the expected behavior? What went wrong? I want to get it in JavaScript (with Puppeteer) in order to serialize specified node's location as a string. Is there an API for that? Did this work before? N/A Chrome version: 66.0.3359.139 Channel: stable OS Version: OS X 10.12.6 Flash Version:
,
May 10 2018
,
Dec 8
You can generate node selector similarly to how we do it in devtools front-end. In general, having a "node" in hands, you can generate its selector from-inside the page using `Runtime.evaluate`. (or page.evaluate, from pptr standpoint) Feel free to jump to pptr bugtracker with this question if there's some confusion left. |
|||
►
Sign in to add a comment |
|||
Comment 1 by woxxom@gmail.com
, May 10 2018