# wd-sync

> sync version of wd using fibers.

Latest version **1.2.5** (published 2013-12-14) · 0 weekly downloads

## Install

```sh
npm install wd-sync
pnpm add wd-sync
yarn add wd-sync
bun add wd-sync
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.5 |
| Published | 2013-12-14 |
| First published | 2012-05-02 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 53 |
| Author | Seb Vincent |
| Maintainers | sebv |
| Keywords | selenium, webdriver, test, fibers, sync |

## Links

- npm: https://www.npmjs.com/package/wd-sync
- Repository: https://github.com/sebv/node-wd-sync
- Issues: https://github.com/sebv/node-wd-sync/issues
- npm.io page: https://npm.io/package/wd-sync

## Dependencies (4)

- [wd](https://npm.io/package/wd.md) ~0.2.7
- [fibers](https://npm.io/package/fibers.md) ~1.0.1
- [lodash](https://npm.io/package/lodash.md) ~2.2.1
- [make-sync](https://npm.io/package/make-sync.md) ~0.2.0

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 1.2.5 (latest) — 2013-12-14
- 1.2.4 — 2013-12-06
- 1.2.3 — 2013-11-17
- 1.2.2 — 2013-11-16
- 1.2.1 — 2013-11-12
- 1.2.0 — 2013-10-31
- 1.1.1 — 2013-10-31
- 1.1.0 — 2013-10-28
- 1.0.5 — 2013-10-15
- 1.0.4 — 2013-08-26
- 1.0.3 — 2013-08-02
- 1.0.2 — 2013-07-12
- 1.0.1 — 2013-01-24
- 1.0.0 — 2012-10-26
- 0.1.11 — 2012-10-08
- … 12 more at https://npm.io/package/wd-sync/versions

## README

# wd-sync

**A synchronous version with a nice api of [wd](http://github.com/admc/wd), 
the lightweight  [WebDriver / Selenium2](http://seleniumhq.org/projects/webdriver/) 
client for node.js, built using  [node-fibers](http://github.com/laverdet/node-fibers).**

[Site](http://sebv.github.io/node-wd-sync/)

Note: headless zombie was removed in 1.1.0

## status

[![Build Status](https://travis-ci.org/sebv/node-wd-sync.png)](https://travis-ci.org/sebv/node-wd-sync)
[![Selenium Test Status](https://saucelabs.com/buildstatus/node_wd_sync)](https://saucelabs.com/u/node_wd_sync)

[![Selenium Test Status](https://saucelabs.com/browser-matrix/node_wd_sync.svg)](https://saucelabs.com/u/node_wd_sync)

## install

```
npm install wd-sync
```

## code samples

### CoffeeScript

```coffeescript
# assumes that selenium server is running

wdSync = require 'wd-sync'

# 1/ simple Wd example

{browser, sync} = wdSync.remote()

sync ->
  console.log "server status:", @status()
  @init browserName:'firefox'
  console.log "session id:", @getSessionId()
  console.log "session capabilities:", @sessionCapabilities()

  @get "http://google.com"
  console.log @title()

  queryField = @elementByName 'q'
  @type queryField, "Hello World"
  @type queryField, "\n"

  @setWaitTimeout 3000
  @elementByCss '#ires' # waiting for new page to load
  console.log @title()

  console.log @elementByNameIfExists 'not_exists' # undefined

  @quit()

```        

### JavaScript

```javascript
// assumes that selenium server is running

var wdSync = require('wd-sync');

// 1/ simple Wd example

var client = wdSync.remote()
    , browser = client.browser
    , sync = client.sync;

sync( function() {

  console.log("server status:", browser.status());
  browser.init( { browserName: 'firefox'} );
  console.log("session id:", browser.getSessionId());
  console.log("session capabilities:", browser.sessionCapabilities());

  browser.get("http://google.com");
  console.log(browser.title());

  var queryField = browser.elementByName('q');
  browser.type(queryField, "Hello World");
  browser.type(queryField, "\n");

  browser.setWaitTimeout(3000);
  browser.elementByCss('#ires'); // waiting for new page to load
  console.log(browser.title());

  console.log(browser.elementByNameIfExists('not_exists')); // undefined

  browser.quit();

});

``` 

## doc 

* [CoffeeScript](http://github.com/sebv/node-wd-sync/blob/master/doc/COFFEE-DOC.md)
* [JavaScript](http://github.com/sebv/node-wd-sync/blob/master/doc/JS-DOC.md)
* [wd doc](https://github.com/admc/wd/blob/master/README.md)
* [JsonWireProtocol official doc](http://code.google.com/p/selenium/wiki/JsonWireProtocol)

Note: Doc and README modifications must be done in the doc/template directory.

## examples

* [CoffeeScript](http://github.com/sebv/node-wd-sync/tree/master/examples/coffee)
* [JavaScript](http://github.com/sebv/node-wd-sync/tree/master/examples/js)

## api

[supported](http://github.com/sebv/node-wd-sync/blob/master/doc/jsonwire-mapping.md)

[full JsonWireProtocol mapping](http://github.com/sebv/node-wd-sync/blob/master/doc/jsonwire-full-mapping.md)
  
## available environments

### WebDriver 

local [WebDriver / Selenium2](http://seleniumhq.org/projects/webdriver/) server

### Sauce Labs

Remote testing with [Sauce Labs](http://saucelabs.com).

## running tests

### local / selenium server: 

1/ Install and start Selenium server

```
./node_modules/.bin/install_selenium
./node_modules/.bin/install_chromedriver
./node_modules/.bin/start_selenium_with_chromedriver
```

2/ run tests
```
make test 
```

### remote / Sauce Labs 

1/ configure sauce environment
```
export SAUCE_USERNAME=<SAUCE_USERNAME>
export SAUCE_ACCESS_KEY=<SAUCE_ACCESS_KEY>
# if using sauce connect
./node_modules/.bin/install_sauce_connect
./node_modules/.bin/start_sauce_connect
```

2/ run tests
```
make test_e2e_sauce
make test_midway_sauce_connect
```

## building doc/mapping

### README + doc

1/ Update the templates

2/ run `make build_doc`

### mappings

1/ Upgrade wd

2/ run `make build_mapping`

## publishing

```
npm version [patch|minor|major]
git push --tags origin master
npm publish
```

---
_Source: https://npm.io/package/wd-sync · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
