jQuery style selectors for wd promises.
In selenium tests with wd, wouldn't it be nice if you could do this:
Because selector's make sense and so does chaining. Approaching selenium webdriver interactions as starting with selectors makes it easy to combine multi-step sequences into terse and expressive statements.
By mapping wd's webdirver API in chainable constructor, a jQuery-esque API is possible with very little code. This is not jQuery. It just looks like it.
Because the nested callback style is unruly for anything complex. Promises are also portable--they can be easily passed around between functions and scopes.
By using the wd promise interface wd-query is able to chain multiple async calls into a unified, selector-driven syntax.
To use, just pass an initialized wd instance (called
convention) to the function exported by wd-query. Note that you must be use
var wd = ;var wdQuery = ;var browser = wd;var $ = ;browser;
If you've already called
browser.init(), for instance at the start of your
test suite, calls to wd-query instances can begin a promise chain.
The ultimate goal is to have pairity with the wd API for all actions that work with css selectors while adding support for selecting multiple elements.
This is a need-based project, so I only wrote it to account for my needs as of right now. If you have suggestestions, opinions, optimizations or fixes, please fork and pull request to contribute.