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

[🐛 Bug]: It would sure be nice to have a selenium-manager build for Raspberry Pi! #13287

Closed
rbovet opened this issue Dec 11, 2023 · 14 comments

Comments

@rbovet
Copy link

rbovet commented Dec 11, 2023

What happened?

Selenium itself is available for Raspberry Pi (linux arm and arm64 versions), but running the file command on selenium-manager reveals that it is an x86-64 build. Now that the Raspberry Pi 4 and 5 are out, they have plenty of power to handle lots of tasks. In my case, I want to use selenium from Ruby to do screen scraping but can't do that without an arm64 version of selenium-manager.
I found issue 11517 very interesting but only about mac-arm64.

How can we reproduce the issue?

On a raspberry pi with Ruby installed, run gem install selenium-webdriver.  Then run 'file' on the executable at ~/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/selenium-webdriver-4.16.0/bin/linux/selenium-manager

Relevant log output

ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, stripped

Operating System

Raspbian bullseye 64 bit (based on Debian 11)

Selenium version

Ruby 3.1.2

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

chromium v119.0.6045.171 (Official Build) Built on Debian, running on Debian 11 (64-bit)

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

selenium-webdriver 4.16.0, also selenium-webdriver 4.15.0

Are you using Selenium Grid?

no

Copy link

@rbovet, 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
Copy link
Member

  1. The only official driver for that Linux / ARM64 is geckodriver. I don't think any of the browsers are supported from official channels.

  2. I'm not sure we can cross compile to linux arm64 with our current means of creating the binary.

  3. It isn't ideal, but if you are savvy enough to be running linux/arm64, you should be able to specify the browser & driver locations in your code.

We'll revisit this option in the future, but we have no current plans for it.

@titusfortner titusfortner closed this as not planned Won't fix, can't repro, duplicate, stale Dec 11, 2023
@seidnerj
Copy link
Contributor

seidnerj commented Dec 30, 2023

There are Chrome versions released by the Raspberry Pi Foundation, here: http://archive.raspberrypi.org/debian/pool/main/c/chromium-browser

There are both arm64 and armhf versions and it is released consistently and promptly. I've been using these without fail for a couple of years now with a forked webdriver_manager (SergeyPirogov/webdriver_manager#540) I created that supports custom urls and templating, unfortunately my PR was rejected but I continue using my implementation.

Not sure if that's considered "official" enough but then again, it is released by the Raspberry Pi Foundation itself so maybe it should be considered as such.

At any rate, the error message that an end user is shown right now on Raspberry Pi is "Unable to obtain working Selenium Manager binary", which is not very informative nor accurate. It kinda hints that something went wrong obtaining to fetch/download the selenium manager binary whereas in reality a selenium-manager binary for that platform/architecture combination simply does not exist.

I would have expected something like "unsupported architecture" but as it is, the implementation here:

really only checks the "platform" is supported, and since Raspberry Pi OS identifies as "linux" the code then proceeds only to fail due to the selenium-manager executable simply being missing.

I think it would make sense to check for supported platform/architecture combinations and not for platform alone, then an appropriate message could be shown. Just my 2 cents.

@titusfortner
Copy link
Member

If the manager isn't there, then it's a packaging issue. All 3 binaries should be included, and if the OS reports as Linux, selenium should find the linux executable and try to use it, and it shouldn't work, and you should get an error from the OS directly that would indicate the architecture issue.

@seidnerj
Copy link
Contributor

seidnerj commented Dec 30, 2023

Got it. I tried uninstalling and then installing Selenium 4.16.0 via pip 3 times and it is still missing.

This is the directory listing on the pi:

~/.pyenv/versions/3.11.4/lib/python3.11/site-packages/selenium/webdriver/common
pi@homebridge ~/.p/v/3/l/p/s/s/w/common ❯❯❯ ls
total 148
drwxr-xr-x 3 pi  4096 Dec 30 18:31 actions
drwxr-xr-x 3 pi  4096 Dec 30 18:31 bidi
drwxr-xr-x 6 pi  4096 Dec 30 18:31 devtools
drwxr-xr-x 3 pi  4096 Dec 30 18:31 html5
drwxr-xr-x 2 pi  4096 Dec 30 18:31 __pycache__
-rw-r--r-- 1 pi 13643 Dec 30 18:31 action_chains.py
-rw-r--r-- 1 pi  2581 Dec 30 18:31 alert.py
-rw-r--r-- 1 pi  1090 Dec 30 18:31 by.py
-rw-r--r-- 1 pi  2924 Dec 30 18:31 desired_capabilities.py
-rw-r--r-- 1 pi  1871 Dec 30 18:31 driver_finder.py
-rw-r--r-- 1 pi   787 Dec 30 18:31 __init__.py
-rw-r--r-- 1 pi  2316 Dec 30 18:31 keys.py
-rw-r--r-- 1 pi  5913 Dec 30 18:31 log.py
-rw-r--r-- 1 pi 10523 Dec 30 18:31 options.py
-rw-r--r-- 1 pi  9058 Dec 30 18:31 print_page_options.py
-rw-r--r-- 1 pi  8654 Dec 30 18:31 proxy.py
-rw-r--r-- 1 pi  5351 Dec 30 18:31 selenium_manager.py
-rw-r--r-- 1 pi  8539 Dec 30 18:31 service.py
-rw-r--r-- 1 pi  4011 Dec 30 18:31 timeouts.py
-rw-r--r-- 1 pi  4360 Dec 30 18:31 utils.py
-rw-r--r-- 1 pi  7827 Dec 30 18:31 virtual_authenticator.py
-rw-r--r-- 1 pi   926 Dec 30 18:31 window.py

Whereas this is the directory listing on my Mac:

~/.pyenv/versions/3.11.4/lib/python3.11/site-packages/selenium/webdriver/common
~/.p/v/3/l/p/s/s/w/common ❯❯❯ ls
total 132
drwxr-xr-x 19 user   608 Dec 29 23:29 __pycache__
drwxr-xr-x 14 user   448 Dec 29 23:29 actions
drwxr-xr-x  6 user   192 Dec 29 23:29 bidi
drwxr-xr-x  6 user   192 Dec 29 23:29 devtools
drwxr-xr-x  5 user   160 Dec 29 23:29 html5
drwxr-xr-x  3 user    96 Dec 29 23:29 linux
drwxr-xr-x  3 user    96 Dec 29 23:29 macos
drwxr-xr-x  3 user    96 Dec 29 23:29 windows
-rw-r--r--  1 user   787 Dec 29 23:29 __init__.py
-rw-r--r--  1 user 13643 Dec 29 23:29 action_chains.py
-rw-r--r--  1 user  2581 Dec 29 23:29 alert.py
-rw-r--r--  1 user  1090 Dec 29 23:29 by.py
-rw-r--r--  1 user  2924 Dec 29 23:29 desired_capabilities.py
-rw-r--r--  1 user  1871 Dec 29 23:29 driver_finder.py
-rw-r--r--  1 user  2316 Dec 29 23:29 keys.py
-rw-r--r--  1 user  5913 Dec 29 23:29 log.py
-rwxr-xr-x  1 user  1944 Dec 29 23:29 mutation-listener.js
-rw-r--r--  1 user 10523 Dec 29 23:29 options.py
-rw-r--r--  1 user  9058 Dec 29 23:29 print_page_options.py
-rw-r--r--  1 user  8654 Dec 29 23:29 proxy.py
-rw-r--r--  1 user  5351 Dec 29 23:29 selenium_manager.py
-rw-r--r--  1 user  8539 Dec 29 23:29 service.py
-rw-r--r--  1 user  4011 Dec 29 23:29 timeouts.py
-rw-r--r--  1 user  4360 Dec 29 23:29 utils.py
-rw-r--r--  1 user  7827 Dec 29 23:29 virtual_authenticator.py
-rw-r--r--  1 user   926 Dec 29 23:29 window.py

Clearly the linux, macos and windows directories are missing.

@seidnerj
Copy link
Contributor

seidnerj commented Dec 30, 2023

@titusfortner

Hmmm, I found the issue, for some reason the wheel file at https://www.piwheels.org/simple/selenium/selenium-4.16.0-py3-none-any.whl DOES NOT contain the selenium-manager binaries at all!

In contrast, the wheel file from https://pypi.org/project/selenium/ (at https://files.pythonhosted.org/packages/dc/72/96b5afa16908f9abc7c24b70adfd3a46c9740eb728ddfeab28379e38eaf9/selenium-4.16.0-py3-none-any.whl) DOES in fact contain the selenium-manager binaries.

How can this be?

Apparently in the default Raspberry Pi OS, pip.conf at "/etc/pip.conf" contains the following:

[global]
extra-index-url=https://www.piwheels.org/simple

(more info here: https://stackoverflow.com/questions/62790359/why-is-my-raspberry-pi-searching-in-only-pypi-simple-version)

@titusfortner
Copy link
Member

I guess it makes sense that if you are custom building a package for a specific platform to remove the large binaries that won't work.

@seidnerj
Copy link
Contributor

I guess. Well since this is the default repo for RPs they are all bound to hit this same issue. Maybe this at least should be documented somewhere. Have no idea where would be a good place for that, I just know I spent several hours trying to sort all of this only to find that the binary isn't even compatible with RP.

Maybe the binaries should be fetched based on the OS instead of bring in the wheel file, or at least attempt to fetch them if they are not present.

If that was the case I would have gotten a sensible error message and would have move on.

@titusfortner
Copy link
Member

Can you PR a one line check for RP architecture and have it raise a better error?

@seidnerj
Copy link
Contributor

Sure, will do that!

@seidnerj
Copy link
Contributor

seidnerj commented Jan 1, 2024

@titusfortner here you go:
#13381

I ended up adding two lines though, not one 😄

@maxp-hover
Copy link

maxp-hover commented Jan 25, 2024

My selenium chromedriver on Raspberry pi setup was working until very recently, I am not sure what happened. But now I'm getting this error when I try Selenium::WebDriver.for :chrome

Selenium::WebDriver::Error::NoSuchDriverError: Unable to obtain chromedriver using Selenium Manager; Unsuccessful command executed: ["/home/max/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/selenium-webdriver-4.17.0/bin/linux/selenium-manager", "--browser", "chrome", "--language-binding", "ruby", "--output", "json"]

/home/max/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/selenium-webdriver-4.17.0/bin/linux/selenium-manager: 1: Syntax error: "(" unexpected
; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location

from /home/max/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/selenium-webdriver-4.17.0/lib/selenium/webdriver/common/driver_finder.rb:30:in `rescue in path'

Caused by Selenium::WebDriver::Error::WebDriverError: Unsuccessful command executed: ["/home/max/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/selenium-webdriver-4.17.0/bin/linux/selenium-manager", "--browser", "chrome", "--language-binding", "ruby", "--output", "json"]
/home/max/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/selenium-webdriver-4.17.0/bin/linux/selenium-manager: 1: Syntax error: "(" unexpected

from /home/max/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/selenium-webdriver-4.17.0/lib/selenium/webdriver/common/selenium_manager.rb:136:in `run'

Running chromedriver --version shows:

ChromeDriver 113.0.5672.59 (3896f0a717ff1a023d64214e29bb578a1dc5ec06-refs/branch-heads/5672@{#849})

@titusfortner
Copy link
Member

@maxp-hover turn on logging: Selenium:WebDriver.logger.level = :debug

We didn't change anything in 4.17 other than to add --language-binding

Copy link

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.

@github-actions github-actions bot locked and limited conversation to collaborators Feb 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants