Make a program created with Python & Selenium into an …
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.0b3
Pay attention to the version. In older versions of Selenium, the methods described in this article may not work.
(To install a specific version with pip, use
pip install selenium==4.0.0b3, for example)
from selenium import webdriver 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