Standalone Selenium Server

Selenium Server, also known as Selenium Grid, is a component of the Selenium testing framework that allows you to run Selenium tests on multiple remote machines or virtual machines simultaneously. It enables parallel test execution, making it a valuable tool for testing web applications across different browsers, operating systems, and devices. Selenium Grid is particularly useful for cross-browser and cross-platform testing to ensure that your web application functions correctly in various environments.

Here are some key features and concepts related to Selenium Server:

  1. Distributed Testing: Selenium Grid allows you to distribute test execution across multiple machines, which can be helpful for reducing test execution time, increasing test coverage, and ensuring consistent test results across different configurations.
  2. Hub and Nodes: In a Selenium Grid setup, there is a central component called the „Hub“ and one or more „Nodes.“ The Hub acts as a central point for test distribution, while Nodes are individual machines or virtual environments where the tests are actually run. You can have multiple Nodes connected to a single Hub.
  3. WebDriver: WebDriver is the API used by Selenium to interact with web browsers. Selenium provides WebDriver implementations for different web browsers, such as ChromeDriver for Google Chrome, GeckoDriver for Mozilla Firefox, and so on. Each WebDriver is responsible for controlling a specific browser instance.
  4. Cross-Browser Testing: With Selenium Grid, you can configure your test cases to run on different web browsers simultaneously. This allows you to verify that your web application works correctly on multiple browsers, ensuring a better user experience for your audience.
  5. Parallel Execution: Selenium Grid enables parallel execution of test cases. This means that you can execute multiple test cases on multiple machines simultaneously, improving the speed and efficiency of your test suite.
  6. Configuration and Desired Capabilities: When setting up Selenium Grid, you define the desired capabilities for each Node. Desired capabilities specify the browser type, version, operating system, and other parameters for the test execution. Test cases are then sent to Nodes that match the desired capabilities.
  7. Scalability: Selenium Grid is scalable, which means you can add or remove Nodes as needed to handle varying test loads. This scalability is particularly valuable for large-scale testing efforts.
  8. Selenium WebDriver Compatibility: Selenium Grid works in conjunction with Selenium WebDriver. Each Node should have the appropriate WebDriver installed and configured for the target browsers.

To set up and use Selenium Grid, you typically configure the Hub and Nodes, specify the desired capabilities for each Node, and then run your tests by directing them to the Hub. The Hub distributes the tests to the appropriate Nodes based on their capabilities.

Overall, Selenium Server (Selenium Grid) and its webdrivers are essential tools for automating web application testing, ensuring compatibility across different browser and platform configurations, and optimizing the testing process through parallel execution.

Prerequisites

Java

java --version
openjdk 17.0.8 2023-07-18
OpenJDK Runtime Environment (build 17.0.8+7-Debian-1deb12u1)
OpenJDK 64-Bit Server VM (build 17.0.8+7-Debian-1deb12u1, mixed mode, sharing)

Create directory

mkdir -p /home/user/bin/Selenium

Download all files here.

cd /home/user/bin/Selenium

Add to $PATH

vi /home/user/.bashrc
export PATH=$PATH:/home/user/bin/Selenium

Download Selenium Server (Grid)

selenium.dev/downloads/

Download Webdriver for Firefox

github.com/mozilla/geckodriver/releases/latest

Start Server

java -jar /home/user/bin/Selenium/selenium-server-4.11.0.jar standalone
22:20:21.024 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
22:20:21.027 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
22:20:21.339 INFO [NodeOptions.getSessionFactories] - Detected 8 available processors
22:20:21.392 WARN [SeleniumManager.lambda$runCommand$1] - Unable to discover proper chromedriver version in offline mode
22:20:21.400 WARN [SeleniumManager.lambda$runCommand$1] - The version of edge cannot be detected. Trying with latest driver version
22:20:21.400 WARN [SeleniumManager.lambda$runCommand$1] - Unable to discover proper msedgedriver version in offline mode
22:20:21.431 WARN [SeleniumManager.lambda$runCommand$1] - Exception trying to discover geckodriver version: Unable to discover proper geckodriver version in offline mode
22:20:21.437 WARN [SeleniumManager.lambda$runCommand$1] - The version of safari cannot be detected. Trying with latest driver version
22:20:21.437 WARN [SeleniumManager.lambda$runCommand$1] - Unable to download safaridriver in offline mode
22:20:21.442 WARN [SeleniumManager.lambda$runCommand$1] - The version of safaritp cannot be detected. Trying with latest driver version
22:20:21.442 WARN [SeleniumManager.lambda$runCommand$1] - Unable to download safaridriver in offline mode
22:20:21.452 INFO [NodeOptions.report] - Adding Firefox for {"browserName": "firefox","platformName": "linux"} 8 times
22:20:21.460 INFO [Node.<init>] - Binding additional locator mechanisms: relative
22:20:21.470 INFO [GridModel.setAvailability] - Switching Node eacdd9bb-6bc7-4d26-b6f4-2c78397fd8bb (uri: http://192.168.0.2:4444) from DOWN to UP
22:20:21.471 INFO [LocalDistributor.add] - Added node eacdd9bb-6bc7-4d26-b6f4-2c78397fd8bb at http://192.168.0.2:4444. Health check every 120s
22:20:21.531 INFO [Standalone.execute] - Started Selenium Standalone 4.11.0 (revision 040bc5406b): http://192.168.0.2:4444

Finished!

http://127.0.0.1:4444