Skip to content

Commit

Permalink
release 0.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Breed committed Sep 25, 2013
1 parent e1b87a8 commit be8ef8a
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ config =

jshint:
all: [
'tasks/**/*.js'
'index.js'
],
options:
jshintrc: '.jshintrc'
Expand Down
55 changes: 54 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
wd-query
========

jQuery style selectors for [wd](https://github.com/admc/wd).
v0.0.3

jQuery style selectors for [wd](https://github.com/admc/wd) promises.

### tl;dr

Expand Down Expand Up @@ -33,10 +35,61 @@ 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.

### Why wd promises?

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.

### Usage

To use, just pass an initialized wd instance (called `browser` by
convention) to the function exported by wd-query. Note that you must be use
`wd.promiseRemote`.

```javascript
var wd = require('wd');
var wdQuery = require('wd-query');

var browser = wd.promiseRemote( ... );
var $ = wdQuery(browser);

browser.init()
.then(function(){
return $('.open-modal').click()
})
.then(function(){
return $('#modal').get();
})
.then(function(elem){
assert.ok(elem)
browser.quit();
});
```

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.

```javascript
$('.open-modal').click().then( ... )
```

### Goals

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.

### Contributing

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.

### License

MIT
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wd-query",
"version": "0.0.2",
"version": "0.0.3",
"description": "A jQuery-esue wrapper for wd",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit be8ef8a

Please sign in to comment.