How to get the absolute XPath for an element withi

2020-02-15 06:02发布

问题:

I used to see the absolute XPath for an element within Firebug. E.g. something like this:

html/body/div[2]/table/tbody/tr/td

When I select a certain element in a table using Firebug, then hover around the highlighted code inside the HTML panel I can't see the XPath anymore.

How to get Firebug to display the XPath again as a tooltip or any other way?

回答1:

The tooltips for elements within the HTML panel were removed in Firebug 2.0, because there were repeated requests saying these tooltips were rather annoying than helpful.

If you need the XPath of an element, you can right-click it and choose Copy XPath from the context menu to copy the absolute XPath of the element to the clipboard.

For elements with and id attribute there's also a new option in Firebug 2.0 to copy a short XPath called Copy Minimal XPath.



回答2:

Firepath is a very nice extension to Firebug which can help with CSS and XPath references.



回答3:

Uncheck the Option of "Generate absolute Xpath":