Skip to content

Instantly share code, notes, and snippets.

@Apocryphon-X
Last active January 1, 2024 15:52
Show Gist options
  • Save Apocryphon-X/3949acbb89478c97aeb9ac3025e0d8f7 to your computer and use it in GitHub Desktop.
Save Apocryphon-X/3949acbb89478c97aeb9ac3025e0d8f7 to your computer and use it in GitHub Desktop.
Create an instance of Google Chrome (using a Chromedriver) with no infobars and no webdriver console. Works with Python 3 and Selenium == 4.0.0b3.
from subprocess import CREATE_NO_WINDOW
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
service = Service("chromedriver.exe")
service.creationflags = CREATE_NO_WINDOW
chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
driver = webdriver.Chrome(options=chrome_options, service=service)
driver.get("https://google.com/")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment