Sometimes, we want to configure ChromeDriver to initiate Chrome browser in Headless mode through Selenium with Python.
In this article, we’ll look at how to configure ChromeDriver to initiate Chrome browser in Headless mode through Selenium with Python.
How to configure ChromeDriver to initiate Chrome browser in Headless mode through Selenium with Python?
To configure ChromeDriver to initiate Chrome browser in Headless mode through Selenium with Python, we can set the headless
option to True
.
For instance, we write
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.headless = True
driver = webdriver.Chrome(CHROMEDRIVER_PATH, options=options)
to create a Options
object.
Then we set options.headless
to True
to make the browser run headless.
Then we initiate the chrome driver with the options
with
driver = webdriver.Chrome(CHROMEDRIVER_PATH, options=options)
Then Chrome will run headless.
Conclusion
To configure ChromeDriver to initiate Chrome browser in Headless mode through Selenium with Python, we can set the headless
option to True
.