You will need the following tools setup before you can run your tests:
- Node 8 or 10
- NPM or Yarn available on your PATH
- Selenium IDE plugin (Chrome or Firefox)
- A CrossBrowserTesting account with an active automation plan
npm install -g selenium-side-runner
yarn global add selenium-side-runner
You will want your CBT account email and auth key available. You can find those here.
Export your test from Selenium IDE
Open the Selenium IDE plugin and import an existing project or create a new one.
On the left side panel, navigate to Test Suites:
Right click your suite and navigate to Settings.
In the settings window, enable ‘Run in parallel’:
Now we can save our test. Look for the save icon in the top right corner of the Selenium IDE window. Click that, name your project, and save it somewhere on your machine.
Running the test
In a command line navigate to the directory where you saved your Selenium IDE project
The fastest way to start a test using selenium-side-runner is to feed it all of info on the command line. It uses the following format:
selenium-side-runner your-project.side -s remotehub -c 'cap1="cap with space" cap2=capvalue'
Let’s assume you saved your project as myproject.side and want to run a test on Windows 10 | Chrome 72 using CrossBrowserTesting
selenium-side-runner myproject.side -s http://hub.crossbrowsertesting.com:80/wd/hub -c 'browserName=Chrome version=72x64 platform="Windows 10" username=EMAIL password=AUTHKEY'
You can navigate to your selenium test results and see the tests execute in real time or see past results.
Using a configuration file
Specifying the remote hub and capabilities on the command line is a quick way to run your suite, but selenium-side-runner can also run them using a configuration file.
By default, selenium-side-runner will look for a configuration file named .side.yml. If we wanted to run the same test we ran earlier, we would create the .side.yml file in the same directory as our project:
capabilities: browserName: "Chrome" version: "72x64" platform: "Windows 10" username: "EMAIL" password: "AUTHKEY" server: "http://hub.crossbrowsertesting.com:80/wd/hub"
We would then run the test using:
Using custom configuration files
selenium-side-runner allows us to specify a configuration file if we don’t want to use the default name or location.
That can be specified by passing –config [filename] as an option to selenium-side-runner.
Let’s assume we had the following directory structure:
suites/ myproject.side config/ win10.chrome72.yml
From the suites directory, you could run:
selenium-side-runner myproject.side --config config/win10.chrome72.yml
selenium-side-runner has additional options that you might find useful. The best place to find that information is on the official Selenium IDE docs
If you need to install Node or NPM, you can find that here.