0

I am trying to initial work of Rselenium. I followed guide from this post: „can't execute rsDriver (connection refused)

library(RSelenium)
#Let's Start
shell('docker pull selenium/standalone-firefox')
shell('docker run -d -p 4445:4444 selenium/standalone-firefox')
remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "firefox")
remDr$open()
remDr$navigate("http://www.google.com")
remDr$getTitle()

But Consoled printed:

> library(RSelenium)
> #Let's Start
> shell('docker pull selenium/standalone-firefox')
Using default tag: latest
Warning: failed to get default registry endpoint from daemon (error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.37/info: open //./pipe/docker_engine: In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.). Using system default: https://index.docker.io/v1/
error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.37/images/create?fromImage=selenium%2Fstandalone-firefox&tag=latest: open //./pipe/docker_engine: Nie można odnaleźć określonego pliku. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
Warning message:
In shell("docker pull selenium/standalone-firefox") :
  wykonywanie 'docker pull selenium/standalone-firefox' error code 1
> shell('docker run -d -p 4445:4444 selenium/standalone-firefox')
docker: error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.37/containers/create: open //./pipe/docker_engine: In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
See 'docker run --help'.
Warning message:
In shell("docker run -d -p 4445:4444 selenium/standalone-firefox") :
  wykonywanie 'docker run -d -p 4445:4444 selenium/standalone-firefox' error code: 125
> remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "firefox")
> remDr$open()
[1] "Connecting to remote server"
Error in checkError(res) : 
  Undefined error in httr call. httr output: Failed to connect to localhost port 4445: Connection refused
> remDr$navigate("http://www.google.com")
Error in checkError(res) : 
  Undefined error in httr call. httr output: length(url) == 1 is not TRUE
> remDr$getTitle()
Error in checkError(res) : 
  Undefined error in httr call. httr output: length(url) == 1 is not TRUE

May I kindly request for a help?

Mikołaj
  • 386
  • 2
  • 16

1 Answers1

0

Run this in cmd @FOR /f "tokens=*" %i IN ('docker-machine.exe env --shell cmd') DO @%i and then try.

Sumit
  • 482
  • 2
  • 6
  • answer: token=*" was unexpected at this time. – Mikołaj Jul 28 '18 at 21:25
  • I also tried to do insert directy to docker "docker pull selenium/standalone-firefox", but the answer... $ docker pull selenium/standalone-firefox Using default tag: latest Warning: failed to get default registry endpoint from daemon (error during conne ct: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.37/info: open //./pipe/docker_e ngine: Nie mona odnale okreonego pliku. In the default daemon configuration on W indows, the docker client must be run elevated to connect. ... – Mikołaj Jul 28 '18 at 22:03
  • ...This error may also i ndicate that the docker daemon is not running.). Using system default: https://i ndex.docker.io/v1/ error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.37/images/cr eate?fromImage=selenium%2Fstandalone-firefox&tag=latest: open //./pipe/docker_en gine: Nie mona odnale okreonego pliku. In the default daemon configuration on Wi ndows, the docker client must be run elevated to connect. This error may also in dicate that the docker daemon is not running. – Mikołaj Jul 28 '18 at 22:05
  • Currently, i wrote command "docker-machine rm default" and "docker-machine create --driver virtualbox default" in Docker, but when I run R i got: remDr remDr$open() [1] "Connecting to remote server" Error in checkError(res) : Undefined error in httr call. httr output: Failed to connect to localhost port 4445: Connection refused – Mikołaj Jul 28 '18 at 22:39
  • And here is another error: > system('docker run -d -p 4445:4444 selenium/standalone-firefox') 4d1819f0e77bcb763eb0103d635b7ec1b22413b7e1aec37e68fd609b01cd73bb C:\Program Files\Docker Toolbox\docker.exe: Error response from daemon: driver failed programming external connectivity on endpoint competent_euclid (132f50d2840ddd44f48cac9a79e12fcfbb1a54a251966b62a27bfbebdb5b4bb7): Bind for 0.0.0.0:4445 failed: port is already allocated. – Mikołaj Jul 28 '18 at 22:46
  • 1
    Docker toolbox allows to run docker command only from quickstart terminal, not from a program. Can you go to quickstart terminal, and run some docker pull directly there..also to check if docker is running, go to virtualbox and see your docker machine vm, it should be in running state, just double click on it, it will take you to machine's terminal. There you can again try running docker pull and lets see of tht works.. – Sumit Jul 29 '18 at 00:40
  • under term "Virtualbox" Do you mean Oracle VM VirtualBox Manager or another programm? – Mikołaj Jul 29 '18 at 14:57
  • Here is a VM outcome [link]https://imgur.com/a/jQDk8zr However Error in R or Docker remain the same: " Error response from daemon: driver failed programming external connectivity on endpoint kind_williams (47645b9e1c6e232c70276d96ec1d48345baafebeb4dbb74ab360ed0d3f2d210a): Bind for 0.0.0.0:4445 failed: port is already allocated." – Mikołaj Jul 29 '18 at 21:32
  • Your docker setup is working fine and now port is already used because of some old container I believe. Run `docker stop $(docker ps -aq)` and `docker rm $(docker ps -aq)`, this will stop and remove all old containers. Try after this. – Sumit Jul 30 '18 at 01:41
  • The same: > system('docker run -d -p 4445:4444 selenium/standalone-firefox') 0c25ab5e44c4f4432d871a62d2775ff2a6a054e943c5f988f924f81ba5406804 C:\Program Files\Docker Toolbox\docker.exe: Error response from daemon: driver failed programming external connectivity on endpoint nervous_lumiere (f1417400492f5fa7df06a3c428bca8877ef7989288ded07b33d84f0c92f7a440): Bind for 0.0.0.0:4445 failed: port is already allocated. – Mikołaj Jul 30 '18 at 09:20