google-chromeselenium-webdrivertestinggoogle-chrome-extensionplaywright

How to Load Extensions Programmatically in Chrome Version 137+?


I have a requirement to load Chrome extensions programmatically into testing browsers such as Selenium and Playwright. To do this, I've been using the --load-extension flag in the launch arguments. Recently, I found that my tests and projects were not loading extensions properly on Google Chrome 137+.

According to this source, the --load-extension flag has been removed from Chrome completely with version 137. This update completely breaks my tools, and probably a lot of other people's test suites. Is there any way to work around this?


Solution

  • This removal is mentioned in this blog, but not in the developer release notes. Some more details are given here.

    Alternative Browsers

    You can use Chrome for Testing which still has the flag. It's a browser build made specifically for automation purposes.

    Alternatively, use Chromium.

    Workaround from the CLI

    A workaround that may not work forever is to set the option:

    --disable-features=DisableLoadExtensionCommandLineSwitch
    

    This turns the --load-extension switch back on. This feature toggle may be removed in one of the next major versions though.

    Selenium BiDi

    If you use Selenium, the next release should allow you to use BiDi to load extensions, but it's not available yet.