Dragur
Dragur

Reputation: 11

Geckodriver doesn't open in aarch64 server

I have an always free Oracle Cloud instance with aarch64 architecture. I'm trying run a basic selenium script, but I'm having problems using geckodriver with selenium.

uname -m
aarch64

Here's my code:

from selenium import webdriver
from selenium.webdriver import FirefoxOptions
from selenium.webdriver.firefox.service import Service

print("init")
options = FirefoxOptions()
options.add_argument("--headless")
options.add_argument("--disable-blink-features=AutomationControlled")
service = Service(executable_path="/usr/local/bin/geckodriver")
driver = webdriver.Firefox(options=options, service=service)
print("Driver ok")
driver.get("https://python.org")
print(driver.title)
driver.close()

I got this error when I try to run it (it stucks trying to open the geckodriver for about 2 minutes and then throw the exception):

python3 prueba.py
init
Traceback (most recent call last):
  File "/home/ubuntu/python/selenium/selenium-env/lib/python3.10/site-packages/urllib3/connectionpool.py", line 536, in _make_request
    response = conn.getresponse()
  File "/home/ubuntu/python/selenium/selenium-env/lib/python3.10/site-packages/urllib3/connection.py", line 507, in getresponse
    httplib_response = super().getresponse()
  File "/usr/lib/python3.10/http/client.py", line 1375, in getresponse
    response.begin()
  File "/usr/lib/python3.10/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.10/http/client.py", line 279, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.10/socket.py", line 705, in readinto
    return self._sock.recv_into(b)
TimeoutError: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/ubuntu/python/selenium/prueba.py", line 10, in <module>
    driver = webdriver.Firefox(options=options, service=service)
  File "/home/ubuntu/python/selenium/selenium-env/lib/python3.10/site-packages/selenium/webdriver/firefox/webdriver.py", line 71, in __init__
    super().__init__(command_executor=executor, options=options)
  File "/home/ubuntu/python/selenium/selenium-env/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 238, in __init__
    self.start_session(capabilities)
  File "/home/ubuntu/python/selenium/selenium-env/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 325, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
  File "/home/ubuntu/python/selenium/selenium-env/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 378, in execute
    response = self.command_executor.execute(driver_command, params)
  File "/home/ubuntu/python/selenium/selenium-env/lib/python3.10/site-packages/selenium/webdriver/remote/remote_connection.py", line 391, in execute
    return self._request(command_info[0], url, body=data)
  File "/home/ubuntu/python/selenium/selenium-env/lib/python3.10/site-packages/selenium/webdriver/remote/remote_connection.py", line 415, in _request
    response = self._conn.request(method, url, body=body, headers=headers, timeout=self._client_config.timeout)
  File "/home/ubuntu/python/selenium/selenium-env/lib/python3.10/site-packages/urllib3/_request_methods.py", line 143, in request
    return self.request_encode_body(
  File "/home/ubuntu/python/selenium/selenium-env/lib/python3.10/site-packages/urllib3/_request_methods.py", line 278, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
  File "/home/ubuntu/python/selenium/selenium-env/lib/python3.10/site-packages/urllib3/poolmanager.py", line 443, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "/home/ubuntu/python/selenium/selenium-env/lib/python3.10/site-packages/urllib3/connectionpool.py", line 843, in urlopen
    retries = retries.increment(
  File "/home/ubuntu/python/selenium/selenium-env/lib/python3.10/site-packages/urllib3/util/retry.py", line 474, in increment
    raise reraise(type(error), error, _stacktrace)
  File "/home/ubuntu/python/selenium/selenium-env/lib/python3.10/site-packages/urllib3/util/util.py", line 39, in reraise
    raise value
  File "/home/ubuntu/python/selenium/selenium-env/lib/python3.10/site-packages/urllib3/connectionpool.py", line 789, in urlopen
    response = self._make_request(
  File "/home/ubuntu/python/selenium/selenium-env/lib/python3.10/site-packages/urllib3/connectionpool.py", line 538, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/home/ubuntu/python/selenium/selenium-env/lib/python3.10/site-packages/urllib3/connectionpool.py", line 369, in _raise_timeout
    raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='localhost', port=45189): Read timed out. (read timeout=120)

Ubuntu:

lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.5 LTS
Release:        22.04
Codename:       jammy

Geckodriver:

geckodriver -V
geckodriver 0.35.0 (9f0a0036bea4 2024-08-03 07:11 +0000)

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

Firefox:

$ firefox-esr -V
Mozilla Firefox 128.4.0esr

Python:

python3 --version
Python 3.10.12

Python packages:

pip list
Package            Version
------------------ -----------
attrs              24.2.0
certifi            2024.8.30
charset-normalizer 3.4.0
exceptiongroup     1.2.2
h11                0.14.0
idna               3.10
outcome            1.3.0.post0
pip                22.0.2
PySocks            1.7.1
requests           2.32.3
selenium           4.26.1
setuptools         59.6.0
sniffio            1.3.1
sortedcontainers   2.4.0
trio               0.27.0
trio-websocket     0.11.1
typing_extensions  4.12.2
urllib3            2.2.3
websocket-client   1.8.0
wsproto            1.2.0

Upvotes: 0

Views: 35

Answers (0)

Related Questions