geckodriver
geckodriver copied to clipboard
selenium error: OpenQA.Selenium.WebDriverArgumentException: 'binary is not a Firefox executable'
System
- Version: geckodriver-v0.34.0-win32
- Platform: Windows 10 22H2
- Firefox: 125.0.2 (64-bits)
- Selenium: Selenium.WebDriver 4.20.0 (installed using nuget in visual studio 2022 (latest update))
Hi
When specifying a path to the geckodriver in Selenium in C# code like this:
FirefoxOptions options = new FirefoxOptions();
options.BrowserExecutableLocation = Application.StartupPath + "\\geckodriver\\geckodriver.exe";
IWebDriver driver = new FirefoxDriver(options);
I get following exception:
OpenQA.Selenium.WebDriverArgumentException: 'binary is not a Firefox executable'
How to solve this?
Can confirm that a similar issue also affects Linux:
org.openqa.selenium.remote.NoSuchDriverException: Unable to obtain: geckodriver, error firefox must exist: /home/username/project-name/firefox-developer-edition
This is an issue only in Selenium 4.20.0, which no longer seems to take $PATH into account when specifying the Firefox executable.
Workarounds:
- Implement
$PATHsearch within Java (clunky and probably only necessary temporarily) - Save the Firefox executable somewhere known, and point to that file (not a nice solution, cluttering the build directory)
- Create a symlink to the executable somewhere known, and hope that this doesn't break anything (also clutters the build directory, but at least the file is small)
- Use shell tools to set a variable like
FIREFOX_PATH="$(type firefox-developer-edition | cut --delimiter=' ' --fields=3-)"and use that variable in Java (clunky, but easy to revert if this issue is fixed).
@trance-babe this seems to be a problem with Selenium. As such please file an issue over there so that it can be fixed if it is unexpected. Thanks.
Installed on fresh ubuntu 22.04 I am using via SSH remotely and:
Traceback (most recent call last):
File "/home/ubuntu/InstaLiker/init_script.py", line 1, in
Installed on fresh ubuntu 22.04 I am using via SSH remotely and:
Traceback (most recent call last): File "/home/ubuntu/InstaLiker/init_script.py", line 1, in from login import login File "/home/ubuntu/InstaLiker/login.py", line 1, in from selenium_func import * File "/home/ubuntu/InstaLiker/selenium_func.py", line 36, in driver = webdriver.Firefox(firefox_profile=profile) File "/home/ubuntu/.local/lib/python3.10/site-packages/selenium/webdriver/firefox/webdriver.py", line 201, in init super().init(command_executor=executor, options=options, keep_alive=True) File "/home/ubuntu/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 286, in init self.start_session(capabilities, browser_profile) File "/home/ubuntu/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 378, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "/home/ubuntu/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute self.error_handler.check_response(response) File "/home/ubuntu/.local/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 245, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 1
Hello, I also encountered this issue with ubuntu22. Have you resolved it
Installed on fresh ubuntu 22.04 I am using via SSH remotely and:
Traceback (most recent call last): File "/home/ubuntu/InstaLiker/init_script.py", line 1, in from login import login File "/home/ubuntu/InstaLiker/login.py", line 1, in from selenium_func import * File "/home/ubuntu/InstaLiker/selenium_func.py", line 36, in driver = webdriver.Firefox(firefox_profile=profile) File "/home/ubuntu/.local/lib/python3.10/site-packages/selenium/webdriver/firefox/webdriver.py", line 201, in init super().init(command_executor=executor, options=options, keep_alive=True) File "/home/ubuntu/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 286, in init self.start_session(capabilities, browser_profile) File "/home/ubuntu/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 378, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "/home/ubuntu/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute self.error_handler.check_response(response) File "/home/ubuntu/.local/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 245, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 1
me too me too ubuntu 24
Traceback (most recent call last): File "/mnt/disk/test.py", line 6, in <module> browser = webdriver.Firefox() ^^^^^^^^^^^^^^^^^^^ File "/home/l/miniconda3/envs/jupyter/lib/python3.11/site-packages/selenium/webdriver/firefox/webdriver.py", line 71, in __init__ super().__init__(command_executor=executor, options=options) File "/home/lonren/miniconda3/envs/jupyter/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 212, in __init__ self.start_session(capabilities) File "/home/l/miniconda3/envs/jupyter/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 299, in start_session response = self.execute(Command.NEW_SESSION, caps)["value"] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/l/miniconda3/envs/jupyter/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 354, in execute self.error_handler.check_response(response) File "/home/l/miniconda3/envs/jupyter/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 1