Paul Biggar
Paul Biggar

Reputation: 28739

Can I use xpath 2.0 with firefox and selenium?

I saw other questions referring to xpath 2.0, which apparently simplifies string expressions. I'm using Firefox 3.5.5 and selenium 1.0.1.

Upvotes: 18

Views: 9748

Answers (3)

Matthieu
Matthieu

Reputation: 39

Currently no browsers support XPath 2.0. To allow the use of a version that comes with Selenium, written in JavaScript, as suggested by @paul-biggar, use the following command :

allowNativeXpath(false)

more informations here : http://www.seleniumwiki.com/software-testing/selenium-ide-allownativexpath/

Upvotes: 0

djangofan
djangofan

Reputation: 29669

I think there is a jQuery plugin that gives you support for XPath 2.0. So, theoretically, if you inject jQuery and the plugin into your browser, maybe you could call XPath 2.0 commands with a JavascriptExecutor. Really, its probably not necessary though, but might be fun to play with.

Upvotes: 1

Paul Biggar
Paul Biggar

Reputation: 28739

By default, selenium uses the "native" version of XPath that comes with the browser. You can make it use a version that comes with Selenium, written in JavaScript. This seems to implement XPath 1.0, based on glancing at the source.

Upvotes: 13

Related Questions