Why you should be using Selenium Manager

💡
Selenium Manager is the official driver manager of the Selenium project, and it is shipped out of the box with every Selenium release.

Do you have an old test project using selenium where you have haven't updated the dependencies in ages? Well there has been great new features added that make your life easier and one of those features is called the Selenium Manager.

Some of the biggest headaches I've dealt with on past Selenium based projects was the constant need to keep the ChromeDriver in sync across the repo (driver package), the test runner, and the tester's local machine. Anyone who has dealt with this knows it can occur quite often. After CfT (Chrome for Testing) came out it became a little easier to control the version on your local and test runner machine browser, but still involved manual intervention and maintenance of the driver package. This is where the beauty of Selenium Manager delivers.

Selenium Manager will automatically determine and download the driver for you, to match the browser on your system. Now you can remove the old driver package and not worry about ever matching it again. And the best part is: all you have to do is install a newer version of Selenium. It is now shipped out of the box with every Selenium release.

💡
If you are defining a driver path or have added an old driver directory to your system path, it's advisable to remove it to allow the manager to handle everything.
[2024-10-30T15:38:49.150Z DEBUG] chromedriver not found in PATH
[2024-10-30T15:38:49.618Z DEBUG] chrome not found in PATH
[2024-10-30T15:38:49.619Z DEBUG] chrome beta not found in the system
[2024-10-30T15:38:49.621Z DEBUG] Discovering versions from https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json
[2024-10-30T15:38:49.731Z DEBUG] Required browser: chrome 131.0.6778.13
[2024-10-30T15:38:49.734Z DEBUG] Downloading chrome 131.0.6778.13 from https://storage.googleapis.com/chrome-for-testing-public/131.0.6778.13/win64/chrome-win64.zip
[2024-10-30T15:39:21.187Z DEBUG] chrome 131.0.6778.13 is available at C:\Users\Work\.cache\selenium\chrome\win64\131.0.6778.13\chrome.exe
[2024-10-30T15:39:21.189Z DEBUG] Discovering versions from https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json
[2024-10-30T15:39:21.671Z DEBUG] Required driver: chromedriver 131.0.6778.13
[2024-10-30T15:39:21.672Z DEBUG] Downloading chromedriver 131.0.6778.13 from https://storage.googleapis.com/chrome-for-testing-public/131.0.6778.13/win64/chromedriver-win64.zip
[2024-10-30T15:39:24.245Z INFO ] Driver path: C:\Users\Work\.cache\selenium\chromedriver\win64\131.0.6778.13\chromedriver.exe
[2024-10-30T15:39:24.245Z INFO ] Browser path: C:\Users\Work\.cache\selenium\chrome\win64\131.0.6778.13\chrome.exe

If that wasn't enough, it also can handle downloading the browser for you as well. This come in handy when you have a hard time maintaining your test runners browser version and just want to run the latest stable or beta version. It will also cache both the browser and driver on the machine for faster startup on future runs.

Now you can run your tests locally on your machine's CfT or normal browser and run the same code against the test runner without having to update any packages.

💡
Please note anonymized data collection from Selenium is on by default. To opt out you can add the environment variable: SE_AVOID_STATS=true. You can also set it in the config.

Happy Testing!