Monday, May 9, 2011

XPath Selectors in IE7 for Selenium....

Apparently IE7 does not have a native XPath selector engine, so Selenium relies on the JavaScript
open-source version You can confirm by unpackaging the Selenium server code (selenium-server-standalone-2.0b3) and dig through the core/xpath directory to confirm this point.

Suppose you have this DIV tag:

<input myAttr="hey"/>

And you want to use XPath selectors to find the appropriate attribute:"//input[@myattr=%s]" % (id_selected))"//input[@myAttr=%s]" % (id_selected))

You can look through all the possible XPath combinations by looking through the test code:

The JavaScript code also has a PathExpr.parse() function that does filter expression matching and parsing.

No comments:

Post a Comment