foosion
foosion

Reputation: 7928

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

Upvotes: 33

Views: 88246

Answers (5)

Nanda Kumar
Nanda Kumar

Reputation: 1

try adding the second and third lines to your code and you should be able to see the devtools messages in your command prompt.

chrome_options=webdriver.ChromeOptions() chrome_options.add_experimental_option('excludeSwitch',['enable-logging']) chrome_options.add_argument('--log-level=3') driver=webdriver.Chrome(executable_path='<path_of_chrome-driver>', options=chrome_options)

Upvotes: 0

Rob
Rob

Reputation: 481

It might be due to chromedriver no longer supports chrome version installed on your machine. Update your Chromedriver to more up to date version.

Upvotes: 0

Dude80
Dude80

Reputation: 1

a workaround: :)

sys.stdout.write("\033[F") #back to previous line
sys.stdout.write("\033[K") #clear line

Upvotes: -7

Enioluwa Segun
Enioluwa Segun

Reputation: 990

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.

Upvotes: 68

user8900239
user8900239

Reputation:

Not sure if you are aware but try:

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

Mind you I'm using headless, though I believe you could configure this for normal browser. It feels better :). I was amazed at how annoying that notification message was.

Upvotes: 0

Related Questions