skip to Main Content

After updating google chrome this weekend, headless mode using Selenium python API is bringing up a blank window when running in windows. The identical code I had running on a Debian VM does not work any longer.

Here is a code snippet:

    chrome_options = Options()
    chrome_options.add_argument("--headless=new") #previously used --headless
    chrome_options.add_argument('--disable-gpu')
    chrome_options.add_argument('--no-sandbox')
    chrome_options.add_argument("--disable-dev-shm-usage")
    chrome_options.add_argument("--disable-automation")
    chrome_options.add_argument("--disable-extensions")
    chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
    driver = webdriver.Chrome(options=chrome_options)

To isolate the problem, I removed all fqdn dns blocks I had enforced for privacy including: ad.doubleclick.net, analytics.yahoo.com, google-analytics.com, googleadservices.com, plausible.io, stats.g.doubleclick.net

2

Answers


  1. It’s a new known bug in Chrome / Chromedriver 129: https://github.com/SeleniumHQ/selenium/issues/14514#issuecomment-2357777800.

    In the meantime, use --window-position=-2400,-2400 to hide the window.

    chrome_options.add_argument("--window-position=-2400,-2400")
    
    Login or Signup to reply.
  2. useful info .
    waiting for the correction

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search