denis
denis

Reputation: 5673

Selenium/standalone-firefox docker on raspberry pi not working: how to use RSelenium on a raspberryPi

I am trying to use RSelenium on a raspberry pi 3 B+. I managed to get R and RSelenium installed.

I first tried to use rsDriver(browser = "firefox"), but I did not manage to get it work (it ends up with an error saying Could not open firefox browser).

As it is recommended to use RSelenium with docker, I am trying to get docker run a Selenium/firefox standalone container.

I managed to get docker up and running. The hello-world run works, as well as an ubuntu bash (docker run -it ubuntu bash gets me an ubuntu terminal).

I pulled a standalone-firefox image with a given version (the 3)

here are the images I have:

ubuntu                        latest              f576a39bda44        2 weeks ago         46.7MB
selenium/standalone-firefox   3                   d803a00f9219        3 weeks ago         756MB
hello-world                   latest              618e43431df9        10 months ago       1.64kB

I then do

sudo docker run -d -p 4445:4444 selenium/standalone-firefox:3

But there is no container when I do docker ps, and

sudo docker ps -a
CONTAINER ID        IMAGE                           COMMAND                  CREATED             STATUS                      PORTS               NAMES
351866263f7b        selenium/standalone-firefox:3   "/opt/bin/entry_poin…"   10 seconds ago      Exited (1) 6 seconds ago                        fervent_noether

shows that the container exited directly when executed. I tried with standalone-firefox:2.53.0 (pulling and executing), and it resulted in the same problem. What I am doing wrong ? The version of standalone-firefox is not supported by the raspberry pi ?

More generally, does someone know how to get RSelenium working on a raspberry pi (with firefox as browser)?


Edit

Following LinPy answer, I tried pulling docker images of selenium browsers compatible with the raspberry pi arm architecture. I found these:

The docker containers ran without problem, but I never manager to have the remoteDriver connected to the broswer in RSelenium (different errors for different reasons, I do not detail here).

The only way I found to use RSelenium on the raspberry-pi without distant server was to execute the java selenium standalone server you can find here (I tried the 2.53.0):

java -jar selenium-server-standalone-2.53.0.jar

And then connect to it in R:

library(RSelenium)
rmDr <- remoteDriver(port = 4444L)
rmDr$open()

It was that easy in the end.

Upvotes: 2

Views: 1777

Answers (2)

LinPy
LinPy

Reputation: 18618

I think there is a missmatch between your app and the os ARCH . Actually it seems like application build for amd64, but you try start it on arm.

so check your Docker / APP versions and make sure they are compatible....

see this and this

Upvotes: 2

Razvan I.
Razvan I.

Reputation: 239

You used the docker container incorrectly. You actually can see your container doing docker ps -a, but it is not good. You specified -p argument and didn't pass any port to that, and you passed the image without a tag. Follow the official documentation for this image and try again step by step:

https://github.com/SeleniumHQ/docker-selenium

Upvotes: 0

Related Questions