17

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.

  • How can I check if my versions of Firefox and Selenium support it?
  • Does Selenium defer to Firefox's built-in Xpath implementation?
  • In that case, if I start using another (perhaps older) browser with selenium, will I run into problems by expecting xpath 2.0?
Shog9
  • 156,901
  • 35
  • 231
  • 235
Paul Biggar
  • 27,579
  • 21
  • 99
  • 152

3 Answers3

12

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.

Paul Biggar
  • 27,579
  • 21
  • 99
  • 152
1

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.

djangofan
  • 28,471
  • 61
  • 196
  • 289
0

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/

Matthieu
  • 39
  • 4