1.1.6 • Published 10 years ago

wd-exec v1.1.6

Weekly downloads
13
License
ISC
Repository
github
Last release
10 years ago

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

1.1.6

10 years ago

1.1.5

10 years ago

1.1.4

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago