mozilla / geckodriver

WebDriver for Firefox
https://firefox-source-docs.mozilla.org/testing/geckodriver/
Mozilla Public License 2.0
7.03k stars 1.51k forks source link

selenium error: OpenQA.Selenium.WebDriverArgumentException: 'binary is not a Firefox executable' #2178

Open ghost opened 2 months ago

ghost commented 2 months ago

System

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?

l0b0 commented 2 months ago

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:

whimboo commented 2 months ago

@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.

lucasrhb commented 2 months ago

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

shenmadouyaowen commented 1 month ago

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