wd-exec
v1.1.6
Published
Tiny Web Driver support selenium webdriver protocol like Phantomjs, sauceLabs
Downloads
49
Maintainers
Readme
wd-exec
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 infohost
default is phantomjs's default host:localhost:8910
sauceLabs
if true, useondemand.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
put request json in body
session.exec('execute', function() {
body: {
script: 'return location',
args: []
}
}, function(err) {
// ...
})
exit
session.exit(function(err) {
// ...
})
License
ISC