0.1.1 • Published 11 years ago

grunt-selenium-launcher v0.1.1

Weekly downloads
23
License
-
Repository
github
Last release
11 years ago

grunt-selenium-launcher

A Grunt task to launch a selenium server.

Usage

Load the task:

grunt.loadNpmTasks('grunt-selenium-launcher');

Call the task:

grunt.registerTask 'e2e-tests', [ 'selenium-launch', 'cucumberjs' ]

Use the settings exported to the environment to connect to the correct instance:

var driver = new require("selenium-webdriver").Builder()
	.usingServer(process.env.SELENIUM_HUB)
	.withCapabilities(webdriver.Capabilities.firefox())
	.build()

API

Grunt Task

selenium-launch Attempt to launch a selenium instance, binding to process.env.SELENIUM_LAUNCHER_PORT. If that port is unavailable, the launcher will iterate ports until it finds one available, and then resets process.env.SELENIUM_LAUNCHER_PORT to that. The task completes when the server is running and bound. The server is automatically killed when the grunt process exits - no need to take extreme steps to ensure the process isn't left a zombie.

Environment Variables

SELENIUM_LAUNCHER_PORT If exported in the shell before running grunt, defines the preferred port to run Selenium on. After the task has run, while inside the node environment it has the value of the port selenium eventually bound on.

SELENIUM_LAUNCHER_PORT=4567 grunt selenium-launch webdriverTask

SELENIUM_HUB After the task has run, has the string URI for webdriver hub connection. Use this string when connecting clients to selenium. See the above examples.

0.1.1

11 years ago

0.1.0

11 years ago

0.0.0

11 years ago