from selenium import webdriver opts = webdriver.ChromeOptions() opts.headless = True with webdriver.Chrome(options = opts) as driver: # do stuff