简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM