Selenium Side Runner: What It Is & How It Works
By Mohammad Waseem, Community Contributor - February 20, 2023
Automation testing using Selenium has become much easier in recent years. A large part of this convenience is due to Selenium IDE. Its playback and recording feature allows users to interact within a URL and create test cases in the IDE. Additionally, packages like selenium-side-runner allow the developers to use the command-line tool to execute tests on a node.js platform.
What is Selenium SIDE Runner?
Selenium SIDE runner is a command-line tool that lets users directly run a .side file on a node.js platform. Anyone familiar with the Selenium IDE is aware that it uses its record and playback features on the web browser and ultimately creates a .side file containing the test logic.
Apart from ease of access and creating test cases Selenium IDE provides access to run tests using the command line runner on the node.js platform.
Prerequisites for running the Selenium SIDE runner
- Selenium IDE
It is easy to install selenium IDE on a web browser. The tool comes as an extension and makes it extremely easy to record test cases. After installation, access the selenium IDE in extensions. Users will see a window like this:
New users should begin with the first option to record a new test in a new project. Here, IDE will ask the user for the project name and the base URL.
After giving the base URL, the IDE will start recording the first test. Interacting in the window with the base URL will create a test case. Save it with a .side extension. The .side extension is what the SIDE runner will be executing on the node.js platform.
To successfully run Selenium test cases using the SIDE runner, users need the node.js platform. Directly download the node.js version suitable for the OS being used from the official website.
- Node.js package manager
The node.js package manager or npm is a command-line tool that is used to update, install, and delete the node.js packages in an application. To install any necessary packages like web driver, use the npm or node.js package manager. The npm will be automatically installed with the node.js installer.
The other dependencies are the selenium-side-runner npm package and the web driver dependency that it comes with.
Why should you use Selenium SIDE Runner?
One of the most obvious reasons to use SIDE runner is that all the files with the .side extension created in the Selenium IDE are easily executed using the Selenium SIDE runner. Other reasons to use Selenium SIDE runner are:
- Selenium test cases can be executed on the node.js platform.
- Selenium SIDE runner can work with multiple web browsers including Chrome, Firefox, Edge, Safari, etc.
- Users can pass runtime configurations to the runner at run time. The tests can be run locally on different browsers or on Selenium grids.
- With Selenium SIDE runner, users can control the number of parallel processes they want to run.
- Users can get the results of test cases in a separate file.
For more advantages of using the Selenium SIDE runner, have a look at the official documentation.
How to Install Selenium SIDE Runner
Installing the selenium SIDE runner is an easy and systematic task. Follow the steps below to successfully do so:
- Open the Command prompt and check whether node.js and npm have been installed.
- Install selenium-side-runner using the following command:
>npm install -g selenium-side-runner
- After the installation is complete, install the web driver to successfully run the selenium SIDE runner. For Chrome, users will need Chromedriver, for Firefox they need Geckodriver, for Edge they need Edgedriver, for IE it will be IEdriver, and for Safari it will be Safaridriver. use the following command to install the driver:
>npm install -g chromedriver
Now let’s explore how to execute the .side file on the node.js platform using the SIDE runner. Note that users must create a test suite with multiple tests on selenium IDE to understand this better.
How to Run Selenium from the Command Line
After creating the test cases in Selenium IDE, save the project file to the xyz location. Ensure that the chromedriver is in PATH so that there are no errors during the execution of the test suite.
To run a test case or test suite in the Selenium SIDE runner, use the following command:
For a test suite with two test cases running in parallel, the output would look like the following:
The output will contain information about the test cases and the time elapsed. Make sure to create complex test cases to understand the functioning of the Selenium SIDE runner better.
At the end of the day, Selenium SIDE runner is best for running test cases with .side file extensions on the node.js platform. With multiple browser support, the tool helps in executing multiple tests parallelly and different configurations for the side runner provide execution on the Selenium grid as well.
Bear in mind that Selenium tests must be run on real devices for accurate results. Start running tests on 2000+ real browsers and devices on BrowserStack’s real device cloud. Run parallel tests on a Cloud Selenium Grid to get faster results without compromising on accuracy. Testers can also conduct Cypress testing on 30+ real browser versions across Windows and macOS. Detect bugs before users do by testing software in real user conditions with BrowserStack.