Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 913889 - dev-python/selenium-4.12.0: "Unable to obtain driver for firefox using Selenium Manager"
Summary: dev-python/selenium-4.12.0: "Unable to obtain driver for firefox using Seleni...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Python Gentoo Team
Depends on:
Reported: 2023-09-09 09:26 UTC by Henrik Johansson
Modified: 2023-10-18 05:46 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Henrik Johansson 2023-09-09 09:26:30 UTC
Updating dev-python/selenium from 4.10.0 to 4.12.0 seems to break the Firefox driver. I'm using dev-lang/python-3.11.5

The following piece of code executes on 4.10.0 but gives the error message below using 4.12.0.


from selenium import webdriver
driver = webdriver.Firefox()


Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/selenium/webdriver/common/", line 38, in get_path
    path = SeleniumManager().driver_location(options) if path is None else path
  File "/usr/lib/python3.11/site-packages/selenium/webdriver/common/", line 78, in driver_location
    args = [str(self.get_binary()), "--browser", browser]
  File "/usr/lib/python3.11/site-packages/selenium/webdriver/common/", line 57, in get_binary
    if not path.is_file() and os.environ["CONDA_PREFIX"]:
  File "<frozen os>", line 679, in __getitem__

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/hrnick/misc/./test", line 3, in <module>
    driver = webdriver.Firefox()
  File "/usr/lib/python3.11/site-packages/selenium/webdriver/firefox/", line 59, in __init__
    self.service.path = DriverFinder.get_path(self.service, options)
  File "/usr/lib/python3.11/site-packages/selenium/webdriver/common/", line 41, in get_path
    raise NoSuchDriverException(msg) from err
selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain driver for firefox using Selenium Manager.; For documentation on this error, please visit:
Comment 1 Hans de Graaff gentoo-dev Security 2023-09-09 09:52:38 UTC
Does it help to install dev-util/selenium-manager ?
Comment 2 Captain Crutches 2023-09-09 12:12:02 UTC
I have the same problem, it also happens when using Chrome - same traceback.

Installing dev-util/selenium-manager does not help.

It looks like it's specifically looking for the manager binary inside the install directory of selenium itself...

From /usr/lib/python3.11/site-packages/selenium/webdriver/common/
> path = Path(__file__).parent.joinpath(directory, file)
which resolves to /usr/lib/python3.11/site-packages/selenium/webdriver/common/linux/selenium-manager
which doesn't exist.
Comment 3 Ben 2023-10-13 02:04:47 UTC
It seems selenium-manager is required for selenium now or at least it seems to be implied upon cursory inspection of the code, should it be a dependency or at least default dependency subject to a USE flag?

I upgraded from 4.5 to 4.13 and got a huge frag bomb waiting for me, breaking my selenium scripts that I need to run daily.  I'm currently waiting for selenium-manager to build, looks like more rusty stuff which will take a while on this box *sigh*
Comment 4 Ben 2023-10-13 02:15:48 UTC
Oh finished earlier than I thought.  dev-util/selenium-manager a large amount of files and thought it would take a while to build, now after running selenium-manager this seems like a script that's way bigger than it needs to be...

Anyway I was able to restore operations after merging it and running my script with a slightly different invocation that worked before without the hack:

CONDA_PREFIX=/usr ./my-selenium-script

I guess this will need to be a workaround for now, but this probably isn't ideal.  Is there anyone who got this working without hacks?
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-10-13 14:27:56 UTC
I'm afraid that none from python@ is really knowledgeable on selenium.  We're merely maintaining it because it's needed by random test suites (dev-python/django, noticeably) and the current package works for that purpose and passes its own tests.

We probably ought to add some kind of postinst message about dev-util/selenium-manager, or even a dependency.  However, it'd really be helpful if you could find some specific documentation/explanation for us, as I'm overwhelmed with other work.

@graaff, perhaps dev-util/selenium-manager could install an env.d file setting SE_MANAGER_PATH?  Apparently this is the first envvar that selenium uses to find the executable (and unlike CONDA_PREFIX, it is unlikely to have side effects).
Comment 6 Ben 2023-10-13 16:29:11 UTC
Hmm, yeah that's probably a better solution compared to the hack inspired by the debug trace.

It looks like selenium's driver model can be manually overridden but this is an API change ("It *was* working...") since Se 4.6 and selenium-manager was meant to "simplify" things .  It seems that it was meant to have multiple versions and download/update the driver (geckodriver, chromedriver, etc.).

Thus there should be some now new mandatory use API options within Se 4.6 and newer to specify the location of the driver, so selenium-manager is technically unnecessary, and that's probably what django's doing.  I couldn't find documentation about this API change either, where it had been automagically working in the past.  This is ridiculous as for me geckodriver is in $PATH (heck it's in /usr/bin) and there is no reason why it couldn't find it - must use some other path now that's no longer based on $PATH.  Grr.

Then there's the old documentation out there that's no longer relevant.  Grr^2.

The crappy thing is that API changes in Se is not new... I had to rewrite when they went from Se 3.x to Se 4.x, so this is technically minor compared to that.

I'm not an expert on this either, just wanted my scraper scripts working :)
Comment 7 Hans de Graaff gentoo-dev Security 2023-10-14 06:25:20 UTC
(In reply to Captain Crutches from comment #2)

> From
> /usr/lib/python3.11/site-packages/selenium/webdriver/common/selenium_manager.
> py:
> > path = Path(__file__).parent.joinpath(directory, file)
> which resolves to
> /usr/lib/python3.11/site-packages/selenium/webdriver/common/linux/selenium-
> manager
> which doesn't exist.

The same thing happens in dev-ruby/selenium-webdriver. In that case I've patched the code to return /usr/bin/selenium-mananger instead of this path and depend on dev-util/selenium-manager.
Comment 8 Ben 2023-10-18 05:32:04 UTC
It doesn't seem this code path is fully tested.  If I set

SE_MANAGER_PATH=/usr/bin/selenium-manager ./my-selenium-script

I get

  File "/usr/lib/python3.11/site-packages/selenium/webdriver/common/", line 60, in get_binary
    if not path.is_file() and os.environ["CONDA_PREFIX"]:
AttributeError: 'str' object has no attribute 'is_file'

Now I'm not an expert pythoneer so I'm not sure how additional methods is added to str objects for path/file detection, but apparently this was not done here, and looks like I have to continue using the hack through CONDA_PREFIX for now...

btw would this be the correct code for line 60?
    if not os.path.isfile(path) and os.environ["CONDA_PREFIX"]:
Comment 9 Ben 2023-10-18 05:46:32 UTC
Above issue was marked in after all, so expect it in next upstream version...