Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
696 views
in Technique[技术] by (71.8m points)

Python selenium: DevTools listening on ws://127.0.0.1

Today I got this message on the console when running selenium using the chromedriver. How do I suppress this?

DevTools listening on ws://127.0.0.1:12740/devtools/browser/97101fe4-3b1f-42b0-b5c8-373cc18040b6

Relevant code:

from selenium import webdriver
driver = webdriver.Chrome(executable_path='c:/bin/chromedriver233')

I get the same message using version 2.30 of chromedriver.

I have not previously received this message. The only change I've made is updating chrome to Version 62.0.3202.94 (Official Build) (64-bit)

Python 3.6.3 64, selenium 3.4.3, Windows 7 64.

EDIT: I posted a question to the Chrome product forum at https://productforums.google.com/forum/#!topic/chrome/Dlk2j_JpmxE;context-place=forum/chrome

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I had the same issue, did a bit of digging and finally found a working solution. This should remove the DevTools message popping up:

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

As per the solution from this chromium issue.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...