Skip to content Skip to sidebar Skip to footer

How To Hide Cmd.exe/console Log Of Chromedriver In Selenium In Python?

How to hide cmd.exe/console log of chromedriver in selenium in python? I tried: driver.service.stop() Full Code: from selenium import webdriver from selenium.webdriver.common.keys

Solution 1:

You cannot hide it completely in Chrome driver but you can suppress few and set minimum log level as below:

from selenium.webdriver.chrome.options importOptionschrome_options= Options()
chrome_options.add_argument('log-level=2')

where log-level is

INFO = 0, 
WARNING = 1, 
LOG_ERROR = 2, 
LOG_FATAL = 3.

Solution 2:

#Combine this two options: from selenium.webdriver.chrome.options import Options
  from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

  options = Options()
  options.add_argument('--log-level=3')

  dc = DesiredCapabilities.CHROME
  dc['loggingPrefs'] = {'driver': 'OFF', 'server': 'OFF', 'browser': 'OFF'}

  self.driver = webdriver.Chrome(chrome_options=options, desired_capabilities=dc, executable_path="C:\\path\\chromedriver.exe")

Post a Comment for "How To Hide Cmd.exe/console Log Of Chromedriver In Selenium In Python?"