Is there a way to get the XPath in Google Chrome?

后端 未结 17 2023
暖寄归人
暖寄归人 2020-11-22 13:53

I have a webpage I want to use with YQL. But I need the XPath of a specific item. I can see it in the debug tools area for Google Chrome but I don\'t see a way to copy tha

相关标签:
17条回答
  • 2020-11-22 14:29

    Slightly OT, but perhaps useful: On Mac Chrome, although you cannot copy the xpath out of the search box in the Dev tools panel (instead, copy grabs the node as HTML), you can drag and drop the text into an external editor.

    0 讨论(0)
  • 2020-11-22 14:31

    Let tell you a simple formula to find xpath of any element:

    1- Open site in browser

    2- Select element and right click on it

    3- Click inspect element option

    4- Right click on selected html

    5- choose option to copy xpath Use it where ever you need it

    This video link will be helpful for you. http://screencast.com/t/afXsaQXru

    Note: For advance options of xpath you must know regex or pattern of your html.

    0 讨论(0)
  • 2020-11-22 14:32

    Just right-click on the element you want the xpath for and you will see a menu item to copy it. This may not have existed when the OP made his post but it's certainly there now.

    0 讨论(0)
  • 2020-11-22 14:35

    You can use $x in the Chrome javascript console. No extensions needed.

    ex: $x("//img")

    Also the search box in the web inspector will accept xpath

    0 讨论(0)
  • 2020-11-22 14:35

    Right click on the node => "Copy XPath"

    0 讨论(0)
提交回复
热议问题