Hi, thank you for your message, probably saved my a lot of time. Just an update from the future.
Maxim Cournoyer <[email protected]> writes: > I'm sharing this bit of knowledge as it was not obvious at all. > Selenium is hard-coded to look for 'firefox' in a couple places, even in > the serialized settings it sends to the browser instance controlled by > geckodriver. > > Here's the initialization that worked using Guix on the > core-updates-frozen-batched-changes branch (where 'geckodriver' was > recently added to IceCat): > > from selenium.webdriver import Firefox, FirefoxOptions > # Monkey patch the KEY string for IceCat. > FirefoxOptions.KEY = "moz:icecatOptions" > options = FirefoxOptions() > options.headless = False > options.binary = 'icecat' > options.set_capability('browserName', 'icecat') > self.driver = Firefox(options=options)# TODO: > > > The non-obvious was monkey patching the 'moz:icecatOptions' string of > the FirefoxOptions object, and having to set the 'browserName' > capability; otherwise a capability/invalid argument execption would be > raised. In the year 2026 there seems to be something called selenium-manager which selenium uses by default, and it does not know icecat. So the invocation changes a bit into: --8<---------------cut here---------------start------------->8--- import selenium import shutil from selenium.webdriver import Firefox, FirefoxOptions service = selenium.webdriver.firefox.service.Service( executable_path=shutil.which("geckodriver")) FirefoxOptions.KEY = "moz:icecatOptions" options = FirefoxOptions() options.set_capability('browserName', 'icecat') driver = Firefox(options=options, service=service) --8<---------------cut here---------------end--------------->8--- > If you use chromedriver (included with) our ungoogled-chromium instead, > it is more straightforward as there is nothing to rename/monkey patch: > > options = ChromeOptions() > options.headless = False > self.driver = Chrome(options=options) ungoogled-chromium does not build for some time now, so no update here. > I hope that helps someone else :-). It definitely did! Tomas -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.
