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

**URL:** <https://onehack.st/t/selenium-driver-auto-updater-a-useful-tool-for-bot-creators-that-use-selenium/165429>\
**Category:** Tools & Scripts\
**Tags:** programming, technology\
**Created:** [December 8, 2020, 4:12pm UTC](https://onehack.st/t/selenium-driver-auto-updater-a-useful-tool-for-bot-creators-that-use-selenium/165429 "2020-12-08T16:12:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahmedayman4a](https://onehack.st/user_avatar/onehack.st/ahmedayman4a/32/37430_2.png) [@ahmedayman4a](https://onehack.st/u/ahmedayman4a)\
**Post date:** [December 8, 2020, 4:12pm UTC](https://onehack.st/t/selenium-driver-auto-updater-a-useful-tool-for-bot-creators-that-use-selenium/165429/1 "2020-12-08T16:12:52Z")

</div>

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 :

```auto
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.

```auto
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](https://github.com/SergeyPirogov/webdriver_manager)**
