Skip to content
Ross Rowe edited this page Mar 21, 2014 · 19 revisions

Introduction

The Sauce OnDemand Grid plugin allows you to leverage your existing Selenium Grid setup with Sauce OnDemand.

At the moment, the plugin only supports running Sauce OnDemand for tests using WebDriver. We are currently looking at including support for Selenium RC.

Installation

If you haven't already done so, download the standalone Selenium Server jar.

To use the plugin, download the jar file from https://repository-saucelabs.forge.cloudbees.com/release/com/saucelabs/sauce-grid-plugin/1.1.0/sauce-grid-plugin-1.1.0.jar and add the sauce-grid-plugin.jar file to the classpath of your Selenium Grid instance, then add the following arguments to the command that launches the hub.

Windows

java -cp selenium-server-standalone-2.37.0.jar;sauce-grid-plugin-1.1.0.jar org.openqa.grid.selenium.GridLauncher -role hub -servlets com.saucelabs.grid.SauceOnDemandAdminServlet,com.saucelabs.grid.SauceOnDemandConsoleServlet

Unix

java -cp selenium-server-standalone-2.37.0.jar:sauce-grid-plugin-1.1.0.jar org.openqa.grid.selenium.GridLauncher -role hub -servlets com.saucelabs.grid.SauceOnDemandAdminServlet,com.saucelabs.grid.SauceOnDemandConsoleServlet

The plugin can then be configured by navigating to

http://YOUR_HUB_HOST:YOUR_HUB_PORT/grid/admin/SauceOnDemandConsoleServlet

and clicking on the 'Configure' link (the plugin will register itself as a node after one minute, so you may have to wait a bit before the configuration page is populated).

This page will allow you to specify the username/access key to be used when running tests against Sauce OnDemand. The maximum number of parallel sessions will automatically populated when the page is saved by finding the number of parallel sessions available to the Sauce user account.

Usage

There are two ways in which the Sauce OnDemand Grid plugin can be configured to be run: by handling all capabilities that aren't handled by existing Nodes or by explicitly handling specific browser/operating system combinations.

To configure the plugin to use Sauce OnDemand for all browser/operating system combinations that aren't explicitly handled by existing nodes, select the 'Handle All Unspecified Capabilities' check box.

To configure the plugin to use Sauce OnDemand for specific browser/operating system combinations, select the desired browsers from the multi-select list. Please note that there are separate lists for SeleniumRC/WebDriver.

Then update your tests to run against the Grid instance, eg.

//run against Firefox v12 on Windows XP
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setPlatform(Platform.XP);
capabilities.setCapability("version", "12");
WebDriver driver = new RemoteWebDriver(new URL("http://YOUR_HUB_HOST:4444/wd/hub"), capabilities);
driver.get("http://www.amazon.com");
...
driver.quit();

Contributing

Information on contributing and building the plugin can be found on the [Development Notes](https://github.com/rossrowe/sauce-grid-plugin/wiki/Development Notes) page

Clone this wiki locally