Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python selenium: DevTools listening on ws://127.0.0.1

Tags:

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

like image 893
foosion Avatar asked Nov 20 '17 12:11

foosion


People also ask

Is it possible to run Selenium code with pyinstaller?

2 Python Selenium code runs perfectly when non headless, but wont even start with headless 2 Pyinstaller & Selenium: When chromedriver is called, a blank chromedriver console window appears 1 Experimental Chrome Options in Selenium Node.js

Is it possible to run Selenium code without headless?

2 Python Selenium code runs perfectly when non headless, but wont even start with headless 2 Pyinstaller & Selenium: When chromedriver is called, a blank chromedriver console window appears

How to define methods and attributes in selenium?

The method and attributes names are case and space sensitive and must match to the Selenium options methods and attributes names. When defining a method, it must be defined in a similar way as in python: method name, opening parenthesis, zero to many arguments and closing parenthesis.


1 Answers

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.

like image 72
Enioluwa Segun Avatar answered Oct 27 '22 08:10

Enioluwa Segun