为什么我在Docker中收到RSelenium的语法错误?

问题描述 投票:0回答:1

我正在尝试遵循本教程RSelenium and scraping,因为这似乎正是我正在尝试做的。使用RSelenium抓取Javascript网站。

我已经安装了Docker,并且一切似乎都不错,但是以下命令遇到了问题:

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

我认为打算是:

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

但是,两个版本均返回此错误:

bash: syntax error near unexpected token `('

我在做什么错?

这里是完整的日志:

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
$

谢谢。

docker rselenium
1个回答
0
投票

您的基本问题是,您试图在bash shell提示符下键入R命令,但这永远行不通。我认为您可能错过了本教程的重点:

您正在使用的Docker映像仅提供Selenium,这是一种用于远程控制Web浏览器的工具。预计您将在主机上运行R,并将RSelenium库指向Docker容器提供的硒服务。

为了遵循该教程,您需要在主机上安装R。

© www.soinside.com 2019 - 2024. All rights reserved.