Packwood
Packwood

Reputation: 281

Why am I getting a syntax error with RSelenium in Docker?

I am trying to follow this tutorial RSelenium and scraping as it seems to be just what I am trying to do. Use RSelenium to scrape a Javascript website.

I have installed Docker and all seems good, but I run into problems with the following command:

remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "firefox'")

which I think is intended to be:

remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "firefox")

However, both versions return this error:

bash: syntax error near unexpected token `('

What am I doing wrong?

Here is the full log:

Starting "default"...
(default) Check network to re-create if needed...
(default) Windows might ask for the permission to configure a dhcp server. Sometimes, such confirmation window is minimized in the taskbar.
(default) Waiting for an IP...
Machine "default" was started.
Waiting for SSH to be available...
Detecting the provisioner...
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.
Regenerate TLS machine certs?  Warning: this is irreversible. (y/n): Regenerating TLS certificates
Waiting for SSH to be available...
Detecting the provisioner...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...



                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/
              \____\_______/

docker is configured to use the default machine with IP 192.168.99.100
For help getting started, check out the docs at https://docs.docker.com


Start interactive shell

graha@LAPTOP-SWIFT MINGW64 /c/Program Files/Docker Toolbox
$ docker pull selenium/standalone-chrome                                                                                Using default tag: latest
latest: Pulling from selenium/standalone-chrome
Digest: sha256:d46e05c47bad20ec4ad675368fa1b7addb6c9529e8fdc23f5eb55629235b8e14
Status: Image is up to date for selenium/standalone-chrome:latest

graha@LAPTOP-SWIFT MINGW64 /c/Program Files/Docker Toolbox
$ docker run -d -p 4445:4444 selenium/standalone-chrome                                                                 fbb8c9145e92789f6941cc04fb74d216d43aed178825c1698ede2644589c715f

graha@LAPTOP-SWIFT MINGW64 /c/Program Files/Docker Toolbox
$ remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "chrome")
bash: syntax error near unexpected token `('

graha@LAPTOP-SWIFT MINGW64 /c/Program Files/Docker Toolbox
$

Thanks.

Upvotes: 0

Views: 91

Answers (1)

larsks
larsks

Reputation: 311606

Your basic problem is that you're trying to type an R command at the bash shell prompt, and that's never going to work. I think you may be missing the point of the tutorial you're following:

The Docker image you're using just provides Selenium, a tool for remotely controlling web browsers. It is expected that you are running R on your host, and pointing the RSelenium library at the selenium service offered by the Docker container.

You will need to install R on your host in order to follow that tutorial.

Upvotes: 1

Related Questions