Edit: I found out that right clicking on a tag in Firebug’s HTML tab and clicking on “Copy XPath” is a much quicker method.
I just discovered a way to quickly find the XPath to any element on a webpage with Firebug. This will help me a lot in the development of my Greasemonkey script HorariGlobal.
- Right-click on element.
- Click on “Inspect element” entry.
- Go to HTML tab in the Firebug frame then the style tab on the right.
- Right-click on empty space in that frame, select “Edit element style”
- Hover mouse over the text item “element.style {” that has just appeared.
I imagine there is a tool somewhere out there that will do this in one step, but this will do me for now.
Right now you can just right click on e.g. a DIV and do “Copy XPath” directly.