Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to validate XPath using Firefox Web Developer Plugin?

Since Web Developer Plugin is an self-sufficient tool, ideally it should contain XPath checker/validator as FireBug did.

Actually I could not find it. I am not sure that it exists. But if it is, please anybody help to navigate to.

Thanks!

like image 721
Andranik Chorokhyan Avatar asked Sep 14 '17 05:09

Andranik Chorokhyan


2 Answers

In Firefox you can use the web developer tools console for xpath validation like this:

1.Open Web Developer tools.

2.Click on Console

3.Type $x("path")

This should let you validate that your path is valid.

References:

https://developer.mozilla.org/en-US/docs/Tools/Web_Console/The_command_line_interpreter

https://developer.mozilla.org/en-US/docs/Web/XPath

like image 154
Rod Molina Avatar answered Sep 20 '22 17:09

Rod Molina


Now it is possible to use xpath directly from the browser.

  1. Open Web Developer tools by pressing F12
  2. In the inspector there is a search bar at the top called Search HTML
  3. Enter your xpath there and type ENTER

Now the inspector should be pointing to the element that was the outcome of evaluating the xpath. For example after evaluating //div[@id="notify-container"] the inspector is pointing to that div

like image 40
aLaix Avatar answered Sep 22 '22 17:09

aLaix