Skip to content Skip to sidebar Skip to footer

How To Suppress Console Error/warning/info Messages When Executing Selenium Python Scripts Using Chrome Canary

I am running python script (complete script link below) for selenium test using Chrome Canary. The test seems to be running fine, however, there are lots of error/warning/info mess

Solution 1:

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

log-level: 
Sets the minimum log level.
Valid values are from 0 to 3: 

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

default is 0.

Solution 2:

If "--log-level" doesn't work for you (as of 75.0.3770.100 it didn't for me), this should:

options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])
driver = webdriver.Chrome(executable_path='<path-to-chrome>', options=options)

see:

https://bugs.chromium.org/p/chromedriver/issues/detail?id=2907#c3

Python selenium: DevTools listening on ws://127.0.0.1

Solution 3:

Works for me in Python/Chrome...

from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--log-level=3')

Solution 4:

You can take help of below link.

List of Chromium Command Line Switches

"--log-level" sets the minimum log level. Valid values are from 0 to 3: INFO = 0, WARNING = 1, LOG_ERROR = 2, LOG_FATAL = 3.

Solution 5:

I have just tested this one, it works for me (C#):

ChromeOptionsoptions=newChromeOptions();
    options.AddArguments("--headless", "--log-level=3");
    RemoteWebDriverdriver=newChromeDriver(options);

Post a Comment for "How To Suppress Console Error/warning/info Messages When Executing Selenium Python Scripts Using Chrome Canary"