问题
Upon typing xpath in fire-path text field, if x-path is correct then it'll display the corresponding HTML code. It was working fine previously.
But now it's not displaying the corresponding HTML code even though the xpath is correct.
Can anyone help me to find the solution for this problem? I even uninstalled fire-path and installed again but still, it's not working.
回答1:
If you visit the GitHub Page of FirePath, it clearly mentions that :
FirePath is a Firebug extension that adds a development tool to edit, inspect and generate XPath expressions and CSS3 Selectors
Now if you visit the Home Page of FireBug, it clearly mentions that :
The Firebug extension isn't being developed or maintained any longer. We invite you to use the Firefox DevTools instead, which ship with Firebug.next
So the direction is clear that We have to use DevTools [F12] which comes integrated with the Mozilla Firefox 56.x + releases onwards.
Example Usage :
Now, let us assume we have to identify the xpath of the Search Box WebElement on Google Home Page.
- Open
Mozilla Firefox 56.xbrowser and browse to the urlhttps://www.google.co.in - Press
F12to open theDevTools - Within the
DevToolssection, on theInspectortab, use theInspectorto identify theSearch BoxWebElement. - Copy the
xpath(absolute) and paste it in a text pad. - Construct a logical unique
xpath. Within the
DevToolssection, on theConsoletab, withinJSsub menu, paste the logical uniquexpathyou have constructed in the following format and hitEnter/Return:$x("logical_unique_xpath_of_search_box")The
WebElementidentified by thexpathwill be reflected.
回答2:
The new version of Firefox is not supporting firebug.
You can use chrome dev tools if you like so.
I personally writing XPath using chrome dev tools
For more info refer my answer here
Is there a way to get the xpath in google chrome?
来源:https://stackoverflow.com/questions/46600775/firepath-not-displaying-html-code-after-typing-x-path