1
我收到以下错误:“ErrorError(checkError(res): Could not connect to host on http://localhost:4444/wd/hub。 请确保Selenium服务器正在运行。”RSelenium错误:无法连接到主机; Selenium服务器没有运行
我正在使用mac版本10.9.5,并下载了所有最新版本的软件包和java。我的代码是:
library(rvest)
library(RSelenium)
library(wdman)
setwd(Path to selenium standalone file)
pJS <- phantomjs(pjs_cmd = "/phantomjs-2.1.1-macosx/bin/phantomjs")
remDr <- remoteDriver(browserName = "phantomjs")
Sys.sleep(5)
remDr$open(silent = FALSE)
然后我得到提到的错误。我试过在终端中使用“java -jar selenium-server-standalone.jar”命令(在我们之后使用cd命令导航到正确的目录)。我试过在remoteDriver()函数中更改我的端口(到4444,5556)。我试过了各种Sys.sleep()次(最多20秒)。当我搜索这个错误时,大多数修复都是针对FireFox或Windows的,不适用于使用PhantomJS
我还可以尝试什么?
第二个选项为我工作(
虽然第一选择仍然给我:您可以使用
rsDriver
功能从RSelenium
或phantomjs
功能从wdman
包相同的错误)。谢谢你的帮助! – jbohning