SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.49k stars 8.15k forks source link

[🐛 Bug]: aarch64 is trying to use linux64 geckodriver #12860

Closed ZiTAL closed 1 year ago

ZiTAL commented 1 year ago

What happened?

I installed selenium by pip, installed firefox by apt, installed geckodriver downloading the aarch64 version. I created the sym links for firefox and geckodriver to use with PATH. I tried to exec a simple script to use headless firefox, but selenium is trying to use linux64 version instead of aarch64.

I tried to put the aarch64 geckodriver in the linux64 folder but I get another error too. Executing the geckodriver command, looks like is working:

1696334921102   geckodriver INFO    Listening on 127.0.0.1:4444

How can we reproduce the issue?

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from selenium                           import webdriver
from webdriver_manager.firefox          import GeckoDriverManager
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.service import Service

options                 = Options()
options.headless        = True
service                 = Service(executable_path=GeckoDriverManager().install())
driver                  = webdriver.Firefox(service=service, options=options)

driver.get("https://www.google.com")
print("Headless Firefox Initialized")
driver.quit()

Relevant log output

Traceback (most recent call last):
  File "/home/pi/scripts/python/s.py", line 16, in <module>
    driver                  = webdriver.Firefox(service=service, options=options)
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/firefox/webdriver.py", line 60, in __init__
    self.service.start()
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/common/service.py", line 98, in start
    self._start_process(self._path)
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/common/service.py", line 204, in _start_process
    self.process = subprocess.Popen(
  File "/usr/lib/python3.10/subprocess.py", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.10/subprocess.py", line 1863, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/home/pi/.wdm/drivers/geckodriver/linux64/v0.33.0/geckodriver'

Changing the geckodriver from linux64 to aarch64:

Traceback (most recent call last):
  File "/home/pi/scripts/python/s.py", line 16, in <module>
    driver                  = webdriver.Firefox(service=service, options=options)
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/firefox/webdriver.py", line 67, in __init__
    super().__init__(command_executor=executor, options=options)
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 205, in __init__
    self.start_session(capabilities)
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 289, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 344, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.10/dist-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

Operating System

orange pi 5 ubuntu Linux opi5 5.10.110-rockchip-rk3588 #23.02.2 SMP Fri Feb 17 23:59:20 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux

Selenium version

4.13.0

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

Mozilla Firefox 115.3.0esr

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

geckodriver 0.33.0 (a80e5fd61076 2023-04-02 18:31 +0000)

Are you using Selenium Grid?

No response

github-actions[bot] commented 1 year ago

@ZiTAL, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

titusfortner commented 1 year ago
  1. This no longer does anything: options.headless = True, you need to add -headless as an argument.
  2. Selenium does not maintain webdriver_manager, so we cannot fix any related issues.

The Selenium suggestions are:

  1. Download manually and use the service class with a reference to it similar to what you have above
  2. Build a custom install of Selenium Manager and try to use that instead: https://github.com/SeleniumHQ/selenium/issues/12651#issuecomment-1734785707
github-actions[bot] commented 10 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.