open-source version http://coderepos.org/share/wiki/JavaScript-XPath. 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:
sel.click("//input[@myattr=%s]" % (id_selected)) sel.click("//input[@myAttr=%s]" % (id_selected))
You can look through all the possible XPath combinations by looking through the test code:
http://svn.coderepos.org/share/lang/javascript/javascript-xpath/trunk/test/functional/index.html
The JavaScript code also has a PathExpr.parse() function that does filter expression matching and parsing.
No comments:
Post a Comment