JSPM

appium-chromedriver

2.5.0beta1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 484092
  • Score
    100M100P100Q191950F
  • License Apache-2.0

Node.js wrapper around chromedriver.

Package Exports

  • appium-chromedriver

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (appium-chromedriver) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Build Status Coverage Status

appium-chromedriver

Node.js wrapper around Chromedriver

This module is written using Traceur which is essentially ECMAscript6 along with the proposed await command for es7.

Usage

import Chromedriver from 'appium-chromedriver';

// 'sync'-like await/Promise usage
async function runSession() {
    let driver = new Chromedriver();
    const desiredCaps = {browserName: 'chrome'};
    await driver.start(desiredCaps);
    let status = await driver.sendCommand('/status', 'GET');
    await driver.stop();
}

// EventEmitter usage
function runSession2() {
    let driver = new Chromedriver();
    const desiredCaps = {browserName: 'chrome'};
    driver.start(desiredCaps);
    driver.on(Chromedriver.EVENT_CHANGED, function (msg) {
        if (msg.state === Chromedriver.STATE_ONLINE) {
            driver.sendCommand('/status', 'GET').then(function (status) {
                driver.stop();
            });
        }
    });
    driver.on(Chromedriver.EVENT_ERROR, function (err) {
        // :-(
    });
}

States

Here's what the Chromedriver state machine looks like:

Chromedriver States

Here are the events you can listen for:

  • Chromedriver.EVENT_ERROR: gives you an error object
  • Chromedriver.EVENT_CHANGED: gives you a state change object, with a state property that can be one of:
    • Chromedriver.STATE_STOPPED
    • Chromedriver.STATE_STARTING
    • Chromedriver.STATE_ONLINE
    • Chromedriver.STATE_STOPPING
    • Chromedriver.STATE_RESTARTING

Custom Chromedriver version

To use a version of Chromedriver not set in the code, use npm config property chromedriver_version.

npm install appium-chromedriver --chromedriver_version="2.16"

Or add the property into your .npmrc file.

chromedriver_version=2.16

Custom binaries url

To use a mirror of the ChromeDriver binaries use npm config property chromedriver_cdnurl. Default is http://chromedriver.storage.googleapis.com.

npm install appium-chromedriver --chromedriver_cdnurl=http://npm.taobao.org/mirrors/chromedriver

Or add the property into your .npmrc file.

chromedriver_cdnurl=http://npm.taobao.org/mirrors/chromedriver

Another option is to use PATH variable CHROMEDRIVER_CDNURL.

CHROMEDRIVER_CDNURL=http://npm.taobao.org/mirrors/chromedriver npm install appium-chromedriver

Dev

We use Gulp for building/transpiling.

Watch

npm run watch

Run Tests

npm test