firefox geckodriver in snap does not work
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
firefox (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
once trying to connect to geckodriver from selenium get:
```
Traceback (most recent call last):
File "/home/
driver = webdriver.
File "/home/
self.
File "/home/
self.
File "/home/
raise WebDriverExcept
selenium.
```
here is a code to reproduce (see lines to toggle with comment `# toggle lines to reproduce`). Create conftest.py with content
```
import os
import time
from datetime import datetime
from pathlib import Path
import pytest
from selenium import webdriver
from selenium.
from selenium.
from webdriver_
DEBUG = os.environ.
@pytest.
def driver(request):
"""Set up webdriver fixture."""
options = Options()
if not DEBUG:
else:
options.
options.
options.
# must create path,
# see https:/
tmp_user = Path("~
os.
tmp_
# toggle lines to reproduce
service = Service(
service = Service(
driver = webdriver.
driver.
driver.
driver.
yield driver
driver.quit()
```
and test_driver.py with
```
def test_1(driver):
driver.get("https:/
a = 1
```
firefox --version
Mozilla Firefox 113.0.2
pip freeze:
absl-py==1.4.0
anyio==3.6.2
asttokens==2.2.1
async-generator
attrs==22.2.0
backcall==0.2.0
bcrypt==4.0.1
cachetools==5.3.0
certifi==2022.12.7
cffi==1.15.1
charset-
click==7.1.2
cloudpickle==2.2.1
cryptography=
decorator==5.1.1
Deprecated==1.2.13
docstring-
exceptiongroup=
executing==1.2.0
fire==0.5.0
google-
google-
google-auth==2.17.2
google-
google-
google-
google-
google-
googleapis-
h11==0.14.0
httpcore==0.16.3
httplib2==0.22.0
httpx==0.23.3
hvac==1.1.0
idna==3.4
iniconfig==2.0.0
ipdb==0.13.13
ipython==8.12.0
jedi==0.18.2
Jinja2==3.1.2
jsonschema==4.17.3
juju==2.9.42.1
jujubundlelib=
kfp==1.8.19
kfp-pipeline-
kfp-server-
kubernetes==19.15.0
lightkube==0.12.0
lightkube-
macaroonbakery=
MarkupSafe==2.1.2
matplotlib-
mypy-extensions
oauthlib==3.2.2
outcome==1.2.0
packaging==23.0
paramiko==2.12.0
parso==0.8.3
pexpect==4.8.0
pickleshare==0.7.5
pluggy==1.0.0
prompt-
protobuf==3.20.3
psutil==5.9.5
ptyprocess==0.7.0
pure-eval==0.2.2
pyasn1==0.4.8
pyasn1-
pycparser==2.21
pydantic==1.10.7
Pygments==2.14.0
pyhcl==0.4.4
pymacaroons==0.13.0
PyNaCl==1.5.0
pyparsing==3.0.9
pyRFC3339==1.1
pyrsistent==0.19.3
PySocks==1.7.1
pytest==7.2.2
pytest-
pytest-
pytest-
python-
python-
pytz==2023.3
PyYAML==5.4.1
requests==2.28.2
requests-
requests-
rfc3986==1.5.0
rsa==4.9
selenium==4.9.0
six==1.16.0
sniffio==1.3.0
sortedcontainer
stack-data==0.6.2
strip-hints==0.1.10
tabulate==0.9.0
termcolor==2.2.0
theblues==0.5.2
tomli==2.0.1
toposort==1.10
tqdm==4.65.0
traitlets==5.9.0
trio==0.22.0
trio-websocket=
typer==0.7.0
typing-
typing-
uritemplate==3.0.1
urllib3==1.26.15
wcwidth==0.2.6
webdriver-
websocket-
websockets==11.0.1
wrapt==1.15.0
wsproto==1.2.0
description: | updated |
description: | updated |
Changed in firefox (Ubuntu): | |
status: | New → Fix Released |
On Ubuntu 23.04 with Firefox snap 114.0.1 and its geckodriver 0.33, I put the above two files in a new directory, then ran
python3 -m venv venv
. venv/bin/activate
pip3 install selenium webdriver-manager pytest
pytest test_driver.py
The run failed with the following error:
ERROR test_driver. py::test_ 1 - selenium. common. exceptions. InvalidArgument Exception: Message: binary is not a Firefox executable
Per https:/ /github. com/mozilla/ geckodriver/ issues/ 2010#issuecomme nt-1116203839, setting options. binary_ location = "/snap/ firefox/ current/ firefox. launcher" fixed it and the test passed. I believe this is the default in recent versions, so just not setting options. binary_ location worked as well.
I then tried commenting out the ~/tmp directory creation bit, as well as toggling between the two 'service' assignments, and in every case the test continued to pass.
Are you using a recent Firefox snap (and its geckodriver) version?