Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ghost opened this issue Apr 24, 2024 · 4 comments

Comments

@ghost
Copy link

ghost commented Apr 24, 2024

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?

@l0b0
Copy link

l0b0 commented Apr 29, 2024

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 $PATH search 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).

@whimboo
Copy link
Collaborator

whimboo commented Apr 29, 2024

@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
Copy link

lucasrhb commented May 2, 2024

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants