MacBook 上的 RSelenium 安装 Chrome

RSelenium Installation on MacBook, with Chrome

我安装了 RSelenium(包),从 hockeyreference.com

抓取一些 NHL 统计数据

它工作正常,但最近停止工作,出现此错误:

[1] "Connecting to remote server"
Could not open chrome browser.
Client error message:
Undefined error in httr call. httr output: Failed to connect to 
localhost port 4567: Connection refused
Check server log for further details.

$client
[1] "No sessionInfo. Client browser is mostly likely not opened."

$server
Process Handle
command : /private/var/folders/dk/kf4tf83n1lg40687w6fmq5wh0000gn/T/Rtmpiy1cOY/file1d1856ef53ae.sh 
system id : 18786
state     : exited
Warning message:
In rsDriver(port = 4567L, geckover = NULL, phantomver = NULL) :
   Could not determine server status.

我试过重新安装,但无法正常工作。这个问题中概述了我的原始安装(使用自制软件,安装了最新的 chrome 驱动程序):

任何帮助都会很棒。我是 运行 RSelenium 的代码在这里:

https://github.com/papelr/nhldatar/blob/master/nhldatar/R/nhldatar-phase-2.R

TL;DR,我无法使 rsDriver 参数起作用,它给出了上面发布的错误:

rsDriver(port = 4567L, geckover = NULL, phantomver = NULL)
remDr <- remoteDriver(browserName = "chrome")
remDr$open()

如果 RSelenium 工作(打开 chrome 浏览器),那么其余的将 运行!谢谢!

我推荐:

  • 为 Mac、

  • 安装 docker
  • 为chrome、firefox(推荐3.5.1版本)或phantom

  • 拉取镜像
  • 运行 docker 中的图像:docker 运行...

  • 创建远程驱动程序:

    remDr <-remoteDriver(remoteServerAddr = "here you IP", 端口 = 4445L, 浏览器名称 = "firefox")

  • 如果你有调试版本,你可以在 VNC 中观看你在做什么