Selenium driver auto updater. A useful tool for bot creators that use selenium

I have seen that a lot of people on this form create useful bots but all these bots share one problem. chromedriver.exe needs to be updated every time google chrome is updated. Most users don’t know that and the bot would just crash on them. I found a tool that automatically updates chromedriver called Webdriver Manager. There different releases of it in different programming languages. Just search for WebdriverManager then write the name of the programming language (ex:WebdriverManager Python).

Here is the one I found for python and how to use it:

Webdriver Manager for Python

The main idea is to simplify management of binary drivers for different browsers.

Supports:

  • ChromeDriver
  • GeckoDriver
  • IEDriver
  • OperaDriver
  • EdgeChromiumDriver

How to use :

  1. Install manager: pip install webdriver_manager
  2. For chrome write this code :
    from selenium import webdriver
    from webdriver_manager.chrome import ChromeDriverManager
    
    driver = webdriver.Chrome(ChromeDriverManager().install())
    

To silent webdriver_manager logs and remove them from console, initialize env variable WDM_LOG_LEVEL with '0' value before your selenium tests:

import os os.environ['WDM_LOG_LEVEL'] = '0'

or via constructor:

ChromeDriverManager(log_level=0).install()

By default all driver binaries are saved to user.home/.wdm folder. You can override this setting and save binaries to project.root/.wdm.

import os

os.environ['WDM_LOCAL'] = '1'

Driver cache by default is valid for 1 day. You are able to change this value using constructor parameter:

ChromeDriverManager( cache_valid_range=1).install()

Project url : https://github.com/SergeyPirogov/webdriver_manager

7 Likes
Friendly Websites

https://igg-games.com/ https://pcgamestorrents.com/ https://pirateiro.com/ ettvdl.com https://crackingpatching.com/ https://glodls.to/ https://prostylex.org/ https://haxnode.com/ https://www.novahax.com/ https://www.sadeempc.com/ freecoursesonline.me ftuapps.dev