0

When I'm launching a new selenium driver I get a message as:

====== WebDriver manager ======
Current chromium version is 90.0.4430
Get LATEST chromedriver version for 90.0.4430 chromium
Driver [/root/.wdm/drivers/chromedriver/linux64/90.0.4430.24/chromedriver] found in cache

I tryed using:

chrome_options.add_experimental_option("excludeSwitches", ["enable-logging"])
chrome_options.add_argument('log-level=2')

But none worked.

Is there a better way ?

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Ezriel_S
  • 248
  • 3
  • 11

5 Answers5

2

To silent webdrivermanager-python logs and remove them from console, you can initialize the env variable WDM_LOG_LEVEL with 0 value before your selenium tests as follows:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
import os

os.environ['WDM_LOG_LEVEL'] = '0'
options = Options()
options.add_argument("start-maximized")
options.add_experimental_option('excludeSwitches', ['enable-logging'])
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
driver.get("https://www.google.com")
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
2

according to documents: just add below code into your files:

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

i have tried it with myself, working very well

yaqin2015
  • 36
  • 3
1

The log-level that you are setting for chrome_options is completely separate from the logs that you are seeing from using the external library webdrivermanager for Python. That library will have its own way of disabling log messages (or at least it should). There are other Python libraries for managing WebDriver installs, such as SeleniumBase for example. Related, you might be able to change the Python logging level to hide that message, see Dynamically changing log level without restarting the application for details.

Michael Mintz
  • 9,007
  • 6
  • 31
  • 48
0

Are you using web driver manager? it looks like that is what is giving you logs (pip install webdriver-manager) . Im using selenium without web driver manager or adding any chrome options to remove logs , and not getting any logs printed.

also see :Turning off logging in Selenium (from Python)

0

This worked for me for webdriver_manager v3.8.3:

from webdriver_manager.core.logger import __logger as wdm_logger
wdm_logger.setLevel(logging.WARNING)
Piyush Kakkar
  • 59
  • 1
  • 1
  • 5