Hide the console in Python Selenium


python selenium

Running Python Selenium causes the ChromeDriver console window to appear.
In this article, I will note how to hide it.


  • Windows 10
  • Python 3.9.0
  • selenium 4.0.0a7

Pay attention to the version. In older versions of Selenium, the methods described in this article may not work.

Source code

The following

from selenium.webdriver.chrome.service import Service
from subprocess import CREATE_NO_WINDOW

service = Service('path/to/chromedriver')
service.creationflags = CREATE_NO_WINDOW

driver = webdriver.Chrome(service=service)

You can hide the console window by directly rewriting the creationflags of the Service class.


Written below.

Related Posts