Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geckodriver fails to find non-snap installed firefox when launched from a snap application #2062

Open
brownan opened this issue Nov 8, 2022 · 2 comments

Comments

@brownan
Copy link

brownan commented Nov 8, 2022

System

  • Version: 0.31.0
  • Platform: Linux Ubuntu 20.04
  • Firefox: 106.0.2
  • Selenium: Python client 3.141.0

In my case, I'm developing a Django project which uses selenium and invokes the geckodriver. When I run from the command line, it works fine. When I run it from PyCharm (installed via snap), the geckodriver returns this error:

selenium.common.exceptions.SessionNotCreatedException: Message: Failed to start browser /snap/firefox/current/firefox.launcher: no such file or directory

I believe this is due to the recent bug https://bugzilla.mozilla.org/show_bug.cgi?id=1769991 and its fix https://hg.mozilla.org/mozilla-central/rev/93e827afaac1

If I'm reading the code right, it checks for the SNAP_INSTANCE_NAME environment variable, but doesn't check its contents. When running from Pycharm, the geckodriver process inherits the value SNAP_INSTANCE_NAME=pycharm-professional and then tries to find firefox at /snap/firefox/current/firefox.launcher instead of its actual location at /usr/bin/firefox

I can verify this by executing my test suite like this:

SNAP_INSTANCE_NAME=foo ./manage.py test
Traceback (most recent call last):
...
selenium.common.exceptions.SessionNotCreatedException: Message: Failed to start browser /snap/firefox/current/firefox.launcher: no such file or directory

whereas without that variable set, the tests run fine.

@mathes2
Copy link

mathes2 commented Jan 27, 2023

i had the same problem, i solved it on my linux-ubuntu 20.04 by a symlink firefox.launcher in new directory /snap/firefox/current/ to /usr/bin/firefox. It's not elegant, but it works.
sudo mkdir /snap/firefox/current
sudo ln -s /usr/bin/firefox /snap/firefox/current/
sudo mv firefox firefox.launcher

@virgostyx
Copy link

Thanks to mathes2. It is the best I could find.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants