我想用RSelenium刮一個網站。但是,當我想連接到Selenium服務器時遇到問題。RSelenium無法連接到主機rsDriver()
可以想象我使用rsDriver()命令啓動硒服務器和瀏覽器:
rsDriver(browser = c('firefox'))
這是產生的輸出:
[1] "Connecting to remote server"
Fehler in checkError(res) :
Couldnt connect to host on http://localhost:4567/wd/hub.
Please ensure a Selenium server is running.
Zusätzlich: Warnmeldung:
In rsDriver(browser = c("firefox")) : Could not determine server status.
備選地我試圖此命令(發現它在另一線程在計算器上):
remDr <- remoteDriver(remoteServerAddr = "localhost"
, port = 4444L
, browserName = "htmlunit"
)
remDr$open()
但它失敗:
[1] "Connecting to remote server"
Fehler in checkError(res) :
Couldnt connect to host on http://localhost:4444/wd/hub.
Please ensure a Selenium server is running.
這是我sessioninfo:
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.2
locale:
[1] de_CH.UTF-8/de_CH.UTF-8/de_CH.UTF-8/C/de_CH.UTF-8/de_CH.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] seleniumPipes_0.3.7 whisker_0.3-2 magrittr_1.5 xml2_1.1.1 jsonlite_1.2 httr_1.2.1
[7] RSelenium_1.7.1 wdman_0.2.2
loaded via a namespace (and not attached):
[1] Rcpp_0.12.9 XML_3.98-1.5 binman_0.1.0 assertthat_0.1 bitops_1.0-6 rappdirs_0.3.1 R6_2.2.0
[8] semver_0.2.0 curl_2.3 subprocess_0.8.0 tools_3.3.2 yaml_2.1.14 caTools_1.17.1 openssl_0.9.6
我在塞拉利昂的MacOS版本10.12.2使用Firefox版本51.0.1(64位)。
任何幫助,非常感謝!
它說了兩次'請確保Selenium服務器正在運行。 'Selenium服務器是否在你的機器上運行? – GGamba