1.1.6 • Published 11 years ago
wd-exec v1.1.6
wd-exec
Tiny Web Driver support selenium webdriver protocol like Phantomjs, sauceLabs
Installation
npm install wd-execUsage
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.idsession.browserthe exact browser info, e.g.
{
name: 'phantomjs',
version: '1.9.8',
platform: 'linux-unknown-64bit'
}Api
init
browserdefault is none, more infohostdefault is phantomjs's default host:localhost:8910sauceLabsif true, useondemand.saucelabs.com:80as 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