The new Selenium Server Jar contains everything you’d need to run a grid. It is also the easiest mode to spin up a Selenium Grid. By default the server will be listening on http://localhost:4444, and that’s the URL you should point your RemoteWebDriver tests. The server will detect the available drivers that it can use from the System PATH
java -jar selenium-server-4.0.0-alpha-7.jar standalone
java -jar selenium-server-4.0.0-alpha-7.jar hub
java -jar selenium-server-4.0.0-alpha-7.jar node --detect-drivers
In Selenium 4, we’ve also added GraphQL, a new way to query the necessary data easily and get exactly the same.
curl -X POST -H "Content-Type: application/json" --data '{ "query": "{grid{uri}}" }' -s http://localhost:4444/graphql | jq .
Step 1: Firstly, start the Event Bus, it serves as a communication path to other Grid components in subsequent steps.
java -jar selenium-server-4.0.0-alpha-7.jar event-bus
Step 2: Start the session map, which is responsible for mapping session IDs to the node the session is running on:
java -jar selenium-server-4.0.0-alpha-7.jar sessions
Step 3: Start the new session queuer, it adds the new session request to a local queue. The distributor picks up the request from the queue.
java -jar selenium-server-4.0.0-alpha-7.jar sessionqueuer
Step 4: Start the Distributor. All the nodes are attached as part of Distributor process. It is responsible for assigning a node, when a create session request in invoked.
java -jar selenium-server-4.0.0-alpha-7.jar distributor --sessions http://localhost:5556 --sessionqueuer http://localhost:5559 --bind-bus false
Step 5: Next step is to start the Router, an address that you’d expose to web
java -jar selenium-server-4.0.0-alpha-7.jar router --sessions http://localhost:5556 --distributor http://localhost:5553 --sessionqueuer http://localhost:5559
Step 6: Finally, add a Node
java -jar selenium-server-4.0.0-alpha-7.jar node --detect-drivers
You can just start a node by the following command:
java -jar selenium-server-4.0.0-alpha-1.jar node -D selenium/standalone-firefox:latest '{"browserName": "firefox"}'
You can start the Selenium server and delegate it to docker for creating new instances:
java -jar selenium-server-4.0.0-alpha-7.jar standalone -D selenium/standalone-firefox:latest '{"browserName": "firefox"}' --detect-drivers false