wd-exec

1.1.6 • Public • Published

wd-exec

Build status NPM version Downloads

Tiny Web Driver support selenium webdriver protocol like Phantomjs, sauceLabs

Installation

npm install wd-exec

Usage

var session = require('wd-exec')()
session.init(function(err, value) {
    session.exec('execute', {
        body: {
            script: 'return 1024',
            args: []
        }
    }, function(err, value) {
        console.log(value)
        // => 1024
        session.exit()
    })
})

after init, u may get session info by

  • session.id
  • session.browser the exact browser info, e.g.
{
    name: 'phantomjs',
    version: '1.9.8',
    platform: 'linux-unknown-64bit'
}

Api

init

  • browser default is none, more info
  • host default is phantomjs's default host: localhost:8910
  • sauceLabs if true, use ondemand.saucelabs.com:80 as host, and use name and key in env: env.SAUCE_USERNAME, env.SAUCE_ACCESS_KEY
session.init({
    browser: {
        name: 'internet explorer',
        version: '8',
        platform: 'WINDOWS'
    },
    host: 'localhost:8910'
}, function(err) {
    // ...
})

sauceLabs

session.init({sauceLabs: true}, function(err) {
    // ...
})

exec

WebDriver protocol

put request json in body

session.exec('execute', function() {
    body: {
        script: 'return location',
        args: []
    }
}, function(err) {
    // ...
})

exit

session.exit(function(err) {
    // ...
})

License

ISC

Package Sidebar

Install

npm i wd-exec

Weekly Downloads

4

Version

1.1.6

License

ISC

Last publish

Collaborators

  • ftft1885