DEV Community

Tony Colston
Tony Colston

Posted on • Updated on

Headless Selenium testing with Chrome extensions is broke AF

In case you ever wondered, you cannot test extensions with Selenium and headless Chrome. Chrome does not support this type of testing.

options = webdriver.ChromeOptions()
# print(dir(options))

# see this
# you cannot test extensions if you are in headless mode?
# it is a bug

But the good news you can load an extension with Selenium easy-peasy. As long as you are not headless.


Another thing I found at least in Windows 10 with this version of chromedriver

ChromeDriver 75.0.3770.140 (2d9f97485c7b07dc18a74666574f19176731995c-refs/branch-heads/3770@{#1155})

I would get a errant chromedriver.exe process that hung around after each test (I was using the Python bindings).

To fix that I switched to using webdriver.Remote and ran the chromedriver.exe by hand only one time.

Top comments (0)