Selenium IDE User Guide 2 (Command Line Runner)
Posted May 26, 2020 • 9 min read
Now you can run all Selenium IDE tests in parallel and on Grid in any browser without writing any code.
Just install the Selenium IDE command line run program, obtain the necessary browser driver(if you run the test locally) and start the run program with the required options from the command prompt.
\ (# prerequisites) Prerequisites
To make the command line running program run normally, the following dependencies are required:
node(Node.js programming language) version
npm(NodeJS package manager), usually with
selenium-side-runner(Selenium IDE command line running program)
And the browser driver we want to use(more on this in the next section)
brew install node
npm install -g selenium-side-runner
Note:Your system configuration may be different from the configuration used in the example above(for example, Homebrew on MacOS). If this is the case, please refer to Package Manager's Node installation documentation or download directly from [Node downloads page]( https://nodejs .org/en/download /) Node installer for your operating system.
\ (# installing-a-browser-driver) Install the browser driver
If you want to run a test \ _local \ _ \, then each browser requires some additional settings.
Selenium communicates with each browser through a small binary application called a browser driver. Each browser has its own browser, you can manually download and add to the system path, or you can use the package manager to install the latest version of the browser driver(recommended).
You also need to install a browser on your computer.
\ (# chrome) Chrome
For Chrome, you need ChromeDriver .
> npm install -g chromedriver
\ (# edge) Edge
For Microsoft Edge, you need to run on Windows, and you also need EdgeDriver .
> npm install -g edgedriver
\ (# firefox) Firefox browser
For Firefox, you need geckodriver .
> npm install -g geckodriver
\ (# internet-explorer) IE browser
For Internet Explorer, you need to run on Windows and also need IEDriver .
> npm install -g iedriver
To make IEDriver work, some other settings are needed. Detailed information here .
\ (# safari) Apple browser
For Safari, you need SafariDriver .
It comes with the latest version of Safari. You only need to take a few steps to enable it on your computer. For more information, see this part of the SafariDriver documentation .
\ (# launching-the-runner) Launching the runner
selenium-side-runner, just call the test on the command line, and then call the path of the previously saved project file to run the test. Please refer to User Guide 1.
> selenium-side-runner /path/to/your-project.side
_Note:If you have multiple
.side files, you can use wildcards(eg
/path/to/*. Side). _
When you run this command, it will start the test in parallel in multiple browser windows and be distributed across
n is the number of CPU cores available on the computer).
The number of processes can be configured at runtime with various parameters available(among others).
Note:Parallel execution occurs automatically at the suite level. If you want to execute the tests in the kit in parallel, you need to change a setting. For details, see [Test Parallelization in Suite](# test-parallelization-in-a-suite).
\ (# run-time-configuration) runtime configuration
Using the running program, you can pass different configuration parameters at runtime.
\ (# running-on-a-different-browser-locally) running on different local browsers
The most common use of the function is to specify another browser for local test execution.
selenium-side-runner -c "browserName = chrome" selenium-side-runner -c "browserName = 'internet explorer'" selenium-side-runner -c "browserName = edge" selenium-side-runner -c "browserName = firefox" selenium-side-runner -c "browserName = safari"
Note:When running the test locally, some settings are required for each browser. For details, see [Installing Browser Driver](# installing-a-browser-driver).
\ (# running-on-selenium-grid) running on Selenium Grid
To run a test on a grid(for example, your own grid or a hosted provider such as Sauce Labs), you can specify it and other functions.
selenium-side-runner --server http://localhost:4444/wd/hub -c "browserName = 'internet explorer' version = '11 .0 'platform =' Windows 8.1 '"
--server specifies the URL of the grid, and
-c is the function you want the grid to use.
You can check here for a complete list of available features.
\ (# specify-the-number-of-parallel-processes) Specify the number of parallel processes
When running on a grid, you may need to control the number of parallel sessions that are running. For this, you can use the
-w n command flag(where
n is the number of processes required).
selenium-side-runner -w 10 --server http://localhost:4444/wd/hub
Running the program will automatically set the number of working programs to the number of CPU cores available on the computer. In most cases, this is the best option.
\ (# chrome-specific-capabilities) Chrome-specific capabilities
If you install Chrome in a non-standard location on your computer, you can specify a path so that ChromeDriver knows where to look.
selenium-side-runner -c "goog:chromeOptions.binary = '/path/to/non-standard/Chrome/install'"
With Chrome-specific features, you can also easily run tests.
selenium-side-runner -c "goog:chromeOptions.args = [disable-infobars, headless]"
\ (# a-framework-at-your-fingertips) Frames within reach
The runner also provides some other conveniences. What you expect to use in traditional test automation frameworks.
\ (# change-the-base-url) Change the base URL
With the ability to specify other basic URLs, you can easily point the test to different environments(for example, local development, testing, staging, production).
selenium-side-runner --base-url https://localhost
\ (# filter-tests) Filter tests
You can also choose to use the
--filter target command flag(where
target is a regular expression value) to run a subset of targets for testing. The name of the test containing the given search criteria will be the only name of the test that is run.
selenium-side-runner --filter smoke
\ (# output-test-results-to-a-file) output test results to a file
If you need to export the test results to a file(for example, when running as part of a CI process), you can use a combination of
--output-directory defines where to place the test result file. It can take an absolute path or a relative path.
--output-format defines the format of the test result file. It can be
jest(for example, JSON) or
junit(for example, XML). The default format is
jest(for example, if you do not specify a type).
selenium-side-runner --output-directory = results # Outputs results in `jest` frormat in` ./results/projectName.json ' selenium-side-runner --output-directory = results --output-format = jest # Outputs results in `jest` frormat in` ./results/projectName.json ' selenium-side-runner --output-directory = results --output-format = junit # Outputs results in `junit` frormat in` ./results/projectName.xml '
\ (# specify-a-default-configuration) Specify the default configuration
You don't have to remember all the required command line parameters(these parameters can be awkward), but you can store runtime parameters in a configuration file.
You can use two configuration files.
\ (# option-1) Option 1
.side.yml creates a file in the directory where the test will be run. The runner will automatically pick it up. This is an example of file content.
capabilities: browserName:"firefox" baseUrl:"https://www.seleniumhq.org" server:"http://localhost:4444/wd/hub"
If you want to ignore the file and use command line parameters instead,
--no-sideyml should be used with other commands at runtime.
\ (# option-2) Option 2
In addition to using the
.side.yml file, you can also specify the run-time parameters with the name and location of your choice in the YAML file, and then specify its location when running the test.
selenium-side-runner --config-file "/path/to/your/config.yaml"
Note:When using the
.side.yml will be ignored.
\ (# selenium-ide-configuration) Selenium IDE configuration
\ (# test-parallelization-in-a-suite) test parallelization in the suite
Out of the box, runners execute the kit in parallel, but the tests in the kit are performed sequentially.
To run tests in parallel in a given suite, you need to update the suite's settings in Selenium IDE.
- Switch to the view in
Test SuitesSelenium IDE
- Click the drop-down menu next to the kit name you want to configure, and then click
- Click the checkbox
Run in parallel
- Please click
- Save your Selenium IDE project file
To configure multiple kits to run in this way, repeat steps 1-4 in each kit. When finished, make sure to save the project file.
\ (# advanced-options) Advanced options
\ (# additional-params) Other parameters
The Selenium IDE plugin can specify its own unique runtime parameters. You can use them through the
This option takes a string of various options(similar to how you specify the function).
\ (# basic-usage) Basic usage
You specify the name of the parameter and its value. The most basic method is to specify a string value.
selenium-side-runner --params "a = 'example-value'"
\ (# nested-parameters) nested parameters
You can also use dot notation to nest parameters.
selenium-side-runner --params "a.b = 'another example-value'"
\ (# array-values) Array values
In addition to strings, you can also specify an array of alphanumeric values.
selenium-side-runner --params "a.b.c = [1,2,3]"
\ (# multiple-parameters) Multiple parameters
--params can only be called once, but you can specify multiple parameters separated by spaces.
selenium-side-runner --params "a = 'example-value' a.b = 'another example-value' a.b.c = [1,2,3]"
\ (# using-a-proxy-server) Use a proxy server
You can use the following options in the running program to pass the proxy function to the browser.
\ (# direct-proxy) Direct proxy
This option configures WebDriver to bypass all browser proxies.
\ (# from-the-command-line) On the command line:
> selenium-side-runner --proxy-type = direct
\ (# in-sideyaml) at
\ (# manual-proxy) Manual proxy
Configure the browser proxy manually.
\ (# from-the-command-line-1) On the command line:
selenium-side-runner --proxy-type = manual --proxy-options = "http = localhost:434 bypass = [http://localhost:434, http://localhost:8080]"
\ (# in-sideyaml-1) at
proxyType:manual proxyOptions: http:http://localhost:434 https:http://localhost:434 ftp:http://localhost:434 bypass: -http://localhost:8080 -http://host:434 -http://somethingelse:32
\ (# pac-proxy) PAC proxy
Configure WebDriver to set the browser proxy using the PAC file at the given URL.
\ (# from-the-command-line-2) On the command line:
selenium-side-runner --proxy-type = pac --proxy-options = "http://localhost/pac"
\ (# in-sideyaml-2) at
\ (# socks-proxy) SOCKS proxy
Create proxy configuration for SOCKS proxy.
\ (# from-the-command-line-3) In the command line:
selenium-side-runner --proxy-type = socks --proxy-options = "socksProxy = localhost:434 socksVersion = 5"
\ (# in-sideyaml-3) at
proxyType:socks proxyOptions: socksProxy:localhost:434 socksVersion:5
\ (# system-proxy) System proxy
Configure WebDriver to use the proxy of the current system.
\ (# from-the-command-line-4) On the command line:
selenium-side-runner --proxy-type = system
\ (# in-sideyaml-4) at
\ (# code-export) Code export
If you want to learn how to convert recorded tests into WebDriver code, or if you want to integrate recorded tests into an existing custom test framework, all you need is code export, which is now available in some languages. You can learn more information here !
- Selenium IDE User Guide 1(Crawler Script Recorder)
- Selenium IDE User Guide 2(Command Line Runner)
- Selenium IDE User Guide 3(Control Flow)
- Selenium IDE User Guide 4(Code Export)
- Selenium IDE User Guide 5(FAQ)
- Selenium IDE User Guide 6(Instruction List)
- Selenium IDE User Guide 7(Parameter Definition)