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 -maarch64Here's my code:
from selenium import webdriverfrom selenium.webdriver import FirefoxOptionsfrom selenium.webdriver.firefox.service import Serviceprint("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.pyinitTraceback (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 outThe 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 -aNo LSB modules are available.Distributor ID: UbuntuDescription: Ubuntu 22.04.5 LTSRelease: 22.04Codename: jammyGeckodriver:
geckodriver -Vgeckodriver 0.35.0 (9f0a0036bea4 2024-08-03 07:11 +0000)The source code of this program is available fromtesting/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 -VMozilla Firefox 128.4.0esrPython:
python3 --versionPython 3.10.12Python packages:
pip listPackage Version------------------ -----------attrs 24.2.0certifi 2024.8.30charset-normalizer 3.4.0exceptiongroup 1.2.2h11 0.14.0idna 3.10outcome 1.3.0.post0pip 22.0.2PySocks 1.7.1requests 2.32.3selenium 4.26.1setuptools 59.6.0sniffio 1.3.1sortedcontainers 2.4.0trio 0.27.0trio-websocket 0.11.1typing_extensions 4.12.2urllib3 2.2.3websocket-client 1.8.0wsproto 1.2.0