How do I suppress console/cmd error messages in python
Those logs are issued by Chrome. You can disable them by launching Chrome with the log level set to Fatal:
options = Options()
options.add_argument('--headless')
options.add_argument('--hide-scrollbars')
options.add_argument('--disable-gpu')
options.add_argument("--log-level=3") # fatal
driver = webdriver.Chrome(chrome_options=options)
Though some messages are not filtered by this flag like DevTools listening on ...
.
To avoid them, you'll have to override the selenium.webdriver.common.service.Service and call subprocess.Popen
with close_fds=True
to avoid the inheritance of the file descriptor.
self.process = subprocess.Popen(cmd, env=self.env,
close_fds=True,
stdout=None,
stderr=None,
stdin=None)