Skip to content

[πŸ› Bug]: Message: binary is not a Firefox executableΒ #14602

@DavideStirparo

Description

@DavideStirparo

What happened?

Even by specifying driver path and browser path (as said here: #13169 and here: https://www.selenium.dev/documentation/selenium_manager/#custom-package-managers ) I still get the "binary is not a Firefox executable" message.

from selenium.webdriver import FirefoxOptions
from selenium import webdriver
import selenium.webdriver.firefox.service as FirefoxService

options = FirefoxOptions()

# which firefox
# /usr/bin/firefox
options.binary_location = "/usr/bin/firefox"

# which geckodriver
# /snap/bin/geckodriver
firefoxdriver_bin = "/snap/bin/geckodriver" 
service = FirefoxService.Service(executable_path=firefoxdriver_bin)

driver = webdriver.Firefox(service=service, options=options)
driver.get("https://pythonbasics.org")

By running

/usr/bin/firefox

The browser is properly launched.

How can we reproduce the issue?

python version: Python 3.12.3

apt install firefox
pip install selenium
python provided_script.py

Relevant log output

Traceback (most recent call last):
  File ".../prova.py", line 16, in <module>
    driver = webdriver.Firefox(service=service, options=options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/.../anaconda3/envs/aiweb/lib/python3.12/site-packages/selenium/webdriver/firefox/webdriver.py", line 71, in __init__
    super().__init__(command_executor=executor, options=options)
  File "/home/.../anaconda3/envs/aiweb/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 212, in __init__
    self.start_session(capabilities)
  File "/home/.../anaconda3/envs/aiweb/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 299, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/.../anaconda3/envs/aiweb/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 354, in execute
    self.error_handler.check_response(response)
  File "/home/.../anaconda3/envs/aiweb/lib/python3.12/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: binary is not a Firefox executable

Operating System

Ubuntu 22.04.4 LTS

Selenium version

Version: 4.25.0

What are the browser(s) and version(s) where you see this issue?

/usr/bin/firefox --version

-->

Mozilla Firefox 131.0.2

What are the browser driver(s) and version(s) where you see this issue?

/snap/bin/geckodriver --version

-->

geckodriver 0.35.0 ( 2024-10-08)

The source code of this program is available from
testing/geckodriver in https://hg.mozilla.org/mozilla-central.

This program is subject to the terms of the Mozilla Public License 2.0.
You can obtain a copy of the license at https://mozilla.org/MPL/2.0/.

Are you using Selenium Grid?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-defectSomething is not working as intendedJ-awaiting answerQuestion asked of user; a reply moves it to triage again

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions