How to suppress console error/warning/info messages when executing selenium python scripts using chrome canary

Gagan Shrestha picture Gagan Shrestha · Oct 14, 2017 · Viewed 20k times · Source

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 messages displayed on the console.

Is there a way to suppress these messages? I have tried: chrome_options.add_argument("--silent"), but does not help. I am not able to find the right solution. Appreciate any help.

Python script : Example script provided here

Python: 3.6.3 Selenium: 3.6.0 Chrome Canary: 63.0.3239.5 (64 bit) ChromeDriver : 2.33

Console messages

Answer

nosam picture nosam · Oct 21, 2017

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.