Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to stop selenium from printing webdriver-manager messages in python?

Each time that I initiate a new webdriver the following text is written to the console:

[WDM] - ====== WebDriver manager ======
[WDM] - Current google-chrome version is 102.0.5005
[WDM] - Get LATEST chromedriver version for 102.0.5005 google-chrome
[WDM] - Driver [C:\Users\klaas\.wdm\drivers\chromedriver\win32\102.0.5005.61\chromedriver.exe] found in cache

My goal was to stop selenium from printing this message to the console. Stack Overflow threads with similar topics to this one showed two options that did not work for me. The first one is:

from selenium.webdriver.chrome.options import Options

options = Options()
options.add_experimental_option("excludeSwitches", ["enable-logging"])
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)

and the second one is:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

import logging
from selenium.webdriver.remote.remote_connection import LOGGER

LOGGER.setLevel(logging.WARNING)

Both of these solutions did work for some others but not for me. Is there some other way to stop selenium from printing webdriver messages?

Solution:
As suggested by MohitC the following code prevented the webdriver-manager messages to be printed:

import logging
logging.getLogger('WDM').setLevel(logging.NOTSET)

>Solution :

These are webdriver-manager logs. You can either uninstall it if you are not using or disable logging as below

import os
os.environ['WDM_LOG'] = "false"

You can also try

import logging
logging.getLogger('WDM').setLevel(logging.NOTSET)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading