'Restricting browser drivers in selenium

I am a newbie to selenium. Just wanted to know how do I restrict the script to take only one version of a browser. I dont want to update my browser driver again and again. please help



Solution 1:[1]

Selenium usually takes the browser that is installed on your machine. So, I didn't understand this - 'restrict the script to take only one version of a browser'. Do you have multiple browser versions installed in your system?

You may follow the following approach:

  1. Install the required version of browser alone in your local machine and don't update it.

  2. Use Bonigarcia WebDriverManager - https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager with your Browser Version. Say, if you want to use chromedriver v88, you may set it to:

    WebDriverManager.chromedriver().driverVersion("88").setup();

This will always use the same browser and driver version.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ahamed Abdul Rahman