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

Can't execute geckodriver on Android #2058

Closed Xehia closed 1 year ago

Xehia commented 1 year ago

System

Testcase

It seems that i can't execute geckodriver, I get Bus error when i try to run the executable.

Bash

root@localhost:~# geckodriver  
Bus error

Python

from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options

opts = Options()
opts.log.level = "trace"
driver = Firefox(options=opts)

Stacktrace

Traceback (most recent call last):
  File "[main.py](http://main.py/)", line 14, in <module>
driver = webdriver.Firefox(options=options)
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/firefox/webdriver.py", line 172, in __init__
    self.service.start()
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/service.py", line 98, in start
    self.assert_process_still_running()
  File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/service.py", line 110, in assert_process_still_running                     raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: Service geckodriver unexpectedly exited. Status code was: -7

Trace-level log

I can't make a trace-level log because i can execute Geckodriver 😭

jamesmortensen commented 1 year ago

@Xehia What's the architecture? Is it arm64 or armhf? (or aarch64 or armv7l or some other variant of these)?

$ uname -a
Xehia commented 1 year ago

@jamesmortensen this is the output from the command:

Linux localhost 4.14.116 #1 SMP PREEMPT Thu Jul 1 17:31:00 CST 2021 aarch64 aarch64 aarch64 GNU/Linux
jamesmortensen commented 1 year ago

For version 0.31.0 there is no aarch64 binary, but there is one for 0.32.0. Do you want to try downloading geckodriver-v0.32.0-linux-aarch64.tar.gz and see if that works?

You can also check your existing geckodriver binary to see what architecture it is built for. Here is what I get for the 3 binaries that I have on my laptop:

$ file geckodriver-aarch64 
geckodriver-aarch64: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=349552b424acbe10a611b053ae1a802dd404b7fc, for GNU/Linux 3.7.0, with debug_info, not stripped

$ file geckodriver-armhf 
geckodriver-armhf: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, BuildID[sha1]=246386a403257771a4564df9286133894bebd950, for GNU/Linux 3.2.0, with debug_info, not stripped

$ file geckodriver-amd64 
geckodriver-amd64: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=2e42cc8549e6edc22056c070596a18cb346ab4b2, for GNU/Linux 3.2.0, with debug_info, not stripped

If you see x86-64, then your binary is built for Intel/AMD and not ARM. Hope this helps!

Xehia commented 1 year ago

@jamesmortensen Thanks it worked, I didn't know the architecture of the OS, so I made a mistake downloading the release for linux64 instead of arch64 🤦🏻‍♂️