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.
It uses a non-XML syntax so that it can be used in URIs and XML attribute values. Note: Support for XPath varies widely; it's supported reasonably well in Firefox (although there are no plans to improve support further), while other browsers implement it to a lesser extent, if at all.
As Selenium wiki states, WebDriver uses the browser's native XPath capabilities wherever possible. When the browser does not support XPath (IE 6/7/8, I'm looking at you), Selenium provides its own implementation, supporting XPath 1.0 (with some caveats, see wiki).
Xpath is same across all browsers.
No. XPaths are interpreted in the same way everywhere.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With