You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ondřej Machulda edited this page Jan 25, 2024
·
6 revisions
Selenium server is useful especially when you need to execute multiple tests at once
or your tests are run in different browsers - like on your CI server.
Selenium server receives commands from php-webdriver and starts new sessions using browser drivers. It acts like hub distributing the commands
among one or multiple nodes.
Download
To run the standalone server, download selenium-server-4.X.Y.jar. The latest version is available on the official Selenium download page or in GitHub releases.
Start the server
Run from command line terminal (replace # with server version).
java -jar selenium-server-#.jar
You may need to provide path to chromedriver/geckodriver binary (if they are not placed in system PATH directory):
These options could be combined and you can define paths for both chromedriver and geckodriver.
Grid mode
If you want to distribute browser sessions among multiple servers ("grid mode" - one Selenium hub and multiple Selenium nodes) please
refer to the Grid documentation.
Install server using Docker
Selenium server could also be started inside Docker container with browser and browser drivers built in - see docker-selenium project.
Run tests via Selenium server
After your selenium server is up and running (either by running the jar file or in Docker), you can start to initiate the browser of your choice from your script:
$host = 'https://localhost:4444'; // for selenium server version 4.x$desiredCapabilities = DesiredCapabilities::chrome(); // or DesiredCapabilities::firefox(); etcv.$driver = RemoteWebDriver::create($host, $desiredCapabilities);