SeleniumBase icon indicating copy to clipboard operation
SeleniumBase copied to clipboard

Chrome 142 removed the "--load-extension" option AND the workaround

Open mdmintz opened this issue 3 months ago • 28 comments

Chrome 142 removed the --load-extension option AND the workaround

Specifically, Chrome-branded Chromium removed the --load-extension option in Chrome 142 and the workaround, which was --disable-features=DisableLoadExtensionCommandLineSwitch. (This doesn't affect Chrome-for-Testing, unbranded Chromium, or other Chromium browsers such as Brave.) Note that Chrome extensions are used for various functionality, such as auth proxy, the Recorder, and other major features!

Image

Required reading on the situation:

https://github.com/SeleniumHQ/selenium/issues/15788

https://support.google.com/chrome/a/answer/7679408?sjid=11437610768047552203-NA#chromeBrsrE137

https://groups.google.com/a/chromium.org/g/chromium-extensions/c/aEHdhDZ-V0E/m/UWP4-k32AgAJ

https://chromium.googlesource.com/chromium/src/+/290ed8046692651ce76088914750cb659b65fb17%5E%21/chrome/browser/extensions/extension_service.cc

Obviously, this is a major problem. Many users (including myself) use UC Mode / CDP Mode with an authenticated proxy, which is set via extension. Going to need to find a workaround for this.


Previously, there was also this ticket for this: https://github.com/seleniumbase/SeleniumBase/issues/3771, but there was a workaround that made things work again: https://github.com/seleniumbase/SeleniumBase/issues/3778. Looks like the workaround for that one was removed, so I'll need to find another workaround.

mdmintz avatar Oct 29 '25 15:10 mdmintz

@mdmintz Any idea how long it will take to make a solution?

bbajwa346 avatar Oct 30 '25 01:10 bbajwa346

As of 4.44.3, extensions and proxy auth are back on regular mode (no stealth). Also, proxy auth is back with CDP Mode. That's it for now. Check back later for more fixes.

mdmintz avatar Oct 31 '25 07:10 mdmintz

For regular mode (non stealth) if the os.path.abspath() for an extension dir was different from the os.path.realpath() path, then version 4.44.4 should fix that.

mdmintz avatar Nov 01 '25 18:11 mdmintz

So is that not working with uc mode? How can we make this work with uc mode because we are scraping G**gle and every request is captcha without uc mode.

ramazan-umutlu avatar Nov 02 '25 11:11 ramazan-umutlu

I also had a problem after updating to version 4.44.4 that I couldn't connect to the proxy. (Linux uses --headless by default. To override, use --headed / --gui. For Xvfb mode instead, use --xvfb. Or you can hide this info by using --headless / --headless2 / --uc.) ============================================================= test session starts ============================================================= platform linux -- Python 3.12.3, pytest-8.4.2, pluggy-1.6.0 plugins: seleniumbase-4.44.4, rerunfailures-16.1, metadata-3.1.1, ordering-0.6, html-4.0.2, xdist-3.8.0 collected 1 item

  • Your version of chromedriver is: 142.0.7444.59
  • And your version of Chrome is: 142.0.7444.59
  • Success! Your chromedriver is compatible with your Chrome!

daniyarabdra15-bit avatar Nov 02 '25 12:11 daniyarabdra15-bit

@ramazan-umutlu @daniyarabdra15-bit It should be working with either regular mode or CDP Mode (but it won't work with plain UC Mode). Have you tried with CDP Mode?

mdmintz avatar Nov 02 '25 19:11 mdmintz

As of 4.44.5, proxy auth for CDP Mode via method arg is back. (It was already working for the command-line option.) Details in https://github.com/seleniumbase/SeleniumBase/issues/4066. That's it for now. Check back later for more fixes.

mdmintz avatar Nov 03 '25 15:11 mdmintz

The basic ad_block=True functionality has been restored for Chrome 142+ in 4.44.6 - https://github.com/seleniumbase/SeleniumBase/releases/tag/v4.44.6

mdmintz avatar Nov 05 '25 06:11 mdmintz

extension_dir parameter not work in SB

enic8041 avatar Nov 05 '25 14:11 enic8041

I am a UC mode user. Is there any workaround to use proxy with UC mode as now ?

201411164 avatar Nov 06 '25 01:11 201411164

Is it possible to use old version of seleniumbase and chromedriver in uc mode?

nikita2122 avatar Nov 06 '25 01:11 nikita2122

If you're using CDP Mode, proxy auth should work as normal. If you're using UC Mode without CDP Mode, you can use https://pypi.org/project/pproxy/ to set auth: pproxy -l http://127.0.0.1:8080 -r http://ip:port#username:password (Then set your proxy in SB to "http://127.0.0.1:8080". Auth is handled by pproxy.)

mdmintz avatar Nov 06 '25 01:11 mdmintz

On CDP mode, the page is loading forever

nikita2122 avatar Nov 06 '25 01:11 nikita2122

On CDP mode, the page is loading forever

Not seeing that. It's working for me both locally and in GitHub Actions. If you're using a specific site that has long page loads, you can change the pageLoadStrategy with the pls arg. Eg. pls="none" / pls="eager". You can also ask for help on the SeleniumBase Discord Server: https://discord.gg/EdhQTn3EyE.

mdmintz avatar Nov 06 '25 02:11 mdmintz

Same problem. UC mod is enabled, proxy authorization not work. Image

upd: I tested proxies from several services. Some worked, some didn't. Maybe the problem is that the services need to do something on their side on the servers... I don't know.

Rigagit avatar Nov 06 '25 09:11 Rigagit

upd: I tested proxies from several services. Some worked, some didn't. Maybe the problem is that the services need to do something on their side on the servers... I don't know.

@Rigagit One thing I've seen is that if the username or password contains a delimiting char (@ or :), then the auth isn't extracted correctly because the format of user:pass@ip:port splits up the components by @ first, and then :. Therefore, don't use usernames or passwords that contain @ or : in them. If that's unavoidable, set the proxy auth using pproxy as mentioned in https://github.com/seleniumbase/SeleniumBase/issues/4053#issuecomment-3494380723. If it's unrelated to that, then it may be an issue with the proxy server itself.

mdmintz avatar Nov 06 '25 14:11 mdmintz

Can I use specific version of chrome in uc mode?

    with SB(
        test=True,
        uc=True,
        proxy=proxy,
        driver_version="141.0.7390.109"
    ) as sb:

This is my code but it seems it's still using the latest version.

nikita2122 avatar Nov 06 '25 16:11 nikita2122

Can I use specific version of chrome in uc mode?

@nikita2122 It'll use the version of Chrome that's installed on your system.

Note that proxy auth doesn't take effect in UC Mode until you've activated CDP Mode (because CDP sets the proxy). Therefore, the first thing you should do when the browser launches is activate_cdp_mode(), otherwise you'll hit an auth pop-up when going to any site before that.

mdmintz avatar Nov 06 '25 17:11 mdmintz

On CDP mode, the page is loading forever

Same issue , pls none regular eager produce the same results , sadly not downloading discord and am forced to wait now lol.

I just uninstalled and went back to older version until stable fix

scrapenetwork avatar Nov 07 '25 16:11 scrapenetwork

guys. If you don't really need the latest chrome version, just download older versions of chrome and link the chrome exe path in the binary location when initiating selenium base. You can install any version of your choice from this site:

https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html

For instance, I wanted a 2025 version but early 2025 so I went with this: https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Win/1405311/

Note that the chrome.exe to link isn't the installation exe but the already installed chrome executable. You can't readily find this on google but you can on the site I linked above.

alexander01202 avatar Nov 23 '25 22:11 alexander01202

I’d like to work on this — I’ll attempt a fix that gracefully falls back if --load-extension is unsupported by the Chrome version. I’ll open a PR soon.

hrishabhp avatar Nov 24 '25 17:11 hrishabhp

I’d like to work on this — I’ll attempt a fix that gracefully falls back if --load-extension is unsupported by the Chrome version. I’ll open a PR soon.

There's already a fallback. When --load-extension isn't supported, driver.webextension.install() automatically tries to load the extension at runtime when the browser is launched (which only works if NOT using a stealth mode such as UC Mode or CDP Mode). The other extension functionality is now handled at the CDP level, such as proxy auth, etc.

mdmintz avatar Nov 24 '25 17:11 mdmintz

@mdmintz Any update on how we can add extensions and still use UC Mode?

bbajwa346 avatar Dec 04 '25 20:12 bbajwa346

and how does this work? 'driver.webextension.install()' if i have extensions how will I pass them?

bbajwa346 avatar Dec 04 '25 20:12 bbajwa346

For custom extensions in UC Mode / CDP Mode after Chrome 142+, you'll need to use a custom chromium browser, such as Opera, Brave, or raw chromium. (Edge works too in the sb_cdp format.)

mdmintz avatar Dec 04 '25 23:12 mdmintz

Okay, I understand. However, I still have one question. If I'm using a browser like Comet or Brave, how can I install extensions manually? For example, if I already have the extension stored locally in a folder such as C://AdBlock_Extension, what steps should I follow to load it into the browser?

bbajwa346 avatar Dec 05 '25 00:12 bbajwa346

To load extensions manually, go to the chrome://extensions/ page for that browser, switch on Developer mode, and click Load unpacked to manually load the extension that you want.

mdmintz avatar Dec 05 '25 00:12 mdmintz

isn't there any auto loading method like --load-extension?

bbajwa346 avatar Dec 05 '25 00:12 bbajwa346