3

I am using a script daily. It's a headless chrome that just checks a site every 5 minutes and suddenly devmode turned on and i can't seem to turn it off. This is my script:

from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument('headless')
driver = webdriver.Chrome + 'E:\Chrome Downloads\chromedriver_win32\chromedriver.exe', chrome_options=options)

And the output is:

[0926/111600.894:ERROR:devtools_http_handler.cc(786)]
DevTools listening on 127.0.0.1:12107

[0926/111601.685:ERROR:browser_gpu_channel_host_factory.cc(103)] Failed to launch GPU process.

It also spews out the F12 developer console info everytime it connects to a new site. :c

Walter
  • 184
  • 2
  • 13
  • I would like to clear up a few things. My script was working fine for around 3 weeks straight without anything modified and now all my selenium scripts are "infected" with this problem. The console for my other script is basically unreadable because it visits 50 pages per minute. – Walter Sep 27 '17 at 09:35
  • The exact same thing started happening to me sometime in the last week. Did you happen to figure out why this started happening? Your fix worked for me! – BWarner Oct 09 '17 at 19:41

2 Answers2

5

I managed to fix it finally :D

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

That was all it took.

Walter
  • 184
  • 2
  • 13
  • The --log-level argument still works except for the first devtools message. It will not spam it's message after every action. If the first message is annoying then i recommend `print("\n"*40)`. If i find a way to eliminate the devtools message then i will update this comment. – Walter Jun 21 '18 at 08:18
  • Was anybody able to solve it properly already? I'm currently working on a script which is delivering data for another application via stdout. Having the webdriver spit out random stuff is not really helpful. Deleting the characters will not help either then. – timothy3001 May 12 '19 at 16:19
5

I was running into the same issue and adding the log-level argument only did not work for me.

On Windows you obviously need to add the following option to your ChromeOptions as well:

options.add_experimental_option('excludeSwitches', ['enable-logging'])

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

timothy3001
  • 765
  • 2
  • 8
  • 17