-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Closed
Labels
A-needs-triagingA Selenium member will evaluate this soon!A Selenium member will evaluate this soon!C-pyPython BindingsPython BindingsD-firefoxI-defectSomething is not working as intendedSomething is not working as intendedOS-linux
Description
Description
I have a python script I have working on one computer, but when I try to run it on my server I get the following error:
self.driver = webdriver.Firefox(service=service, options=options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/selenium/webdriver/firefox/webdriver.py", line 71, in __init__
super().__init__(command_executor=executor, options=options)
File ".venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 241, in __init__
self.start_session(capabilities)
File ".venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 329, in start_session
response = self.execute(Command.NEW_SESSION, caps)["value"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 384, in execute
self.error_handler.check_response(response)
File ".venv/lib/python3.12/site-packages/selenium/webdriver/remote/errorhandler.py", line 232, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: binary is not a Firefox executable
Here is the code I'm running:
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
import selenium.webdriver.firefox.service as FirefoxService
options = Options()
service = FirefoxService.Service(executable_path='/snap/bin/geckodriver')
options.binary_location = "/usr/bin/firefox"
webdriver.Firefox(service=service, options=options)
On my computer where this worked, I didn't need to specify locations for geckodriver or firefox. If I get rid of the arguments to webdriver.Firefox, I get the same result, by the way, so I'm not sure they're doing anything...
Here is some relevant version info for the original computer where this worked:
- OS: Linux Mint 22.1
- Python v3.12.3
- Selenium v4.27.1
- Firefox v135.0.1
- Gecko - interestingly
which geckodriverreturns nothing
Here is some version information for the server where I am encountering this issue:
- OS: Ubuntu 22.04.5 LTS
- Python v3.12.10
- Selenium v4.31.0
- Firefox v138.0
- Gecko v0.36.0
Reproducible Code
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
import selenium.webdriver.firefox.service as FirefoxService
options = Options()
service = FirefoxService.Service(executable_path='/snap/bin/geckodriver')
options.binary_location = "/usr/bin/firefox"
webdriver.Firefox(service=service, options=options)Debugging Logs
self.driver = webdriver.Firefox(service=service, options=options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/selenium/webdriver/firefox/webdriver.py", line 71, in __init__
super().__init__(command_executor=executor, options=options)
File ".venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 241, in __init__
self.start_session(capabilities)
File ".venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 329, in start_session
response = self.execute(Command.NEW_SESSION, caps)["value"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 384, in execute
self.error_handler.check_response(response)
File ".venv/lib/python3.12/site-packages/selenium/webdriver/remote/errorhandler.py", line 232, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: binary is not a Firefox executable
Metadata
Metadata
Assignees
Labels
A-needs-triagingA Selenium member will evaluate this soon!A Selenium member will evaluate this soon!C-pyPython BindingsPython BindingsD-firefoxI-defectSomething is not working as intendedSomething is not working as intendedOS-linux