I’m using selenium in my test suite, but since it’s slow to set up, I’d like to prototype my xpaths on live pages, rather than waiting for tests to run. Is there a good way to do this?
- Firebug’s $x xpath seems to not work very well
- jQuery doesn’t seem to support Xpath selectors natively, though it used to in version 1.2.
- using the native javascript stuff (
document.evaluator(...)) is verbose and doesn’t return lists, making it irritating to use.
What’s a good solution? Perhaps there’s a way to use selenium as a nice REPL directly?
Download the Selenium IDE Firefox plugin. It has what you’re looking for and more.
You can enter an xpath, and it’ll highlight the resulting elements for you. There’s also drop-downs to select the Selenium functions you want to invoke.
It also adds context sensitive entries to your context menu (right click some text, then “AssertEquals” on it for example.)