简体   繁体   中英

RSelenium Installation on MacBook, with Chrome

I have RSelenium (the package) installed, to do some scraping of NHL statistics from hockeyreference.com

It was working, all fine, but recently stopped working, giving this error:

[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.

I've tried reinstalling, but could not get it working. My original install is outlined in this question (using homebrew, with the latest chromedriver installed):

Css selector issue with rvest and NHL statistics

Any help would be great. The code I'm running with RSelenium is here:

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

TL;DR, I can't get the rsDriver argument to work, and it gives the error posted above:

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

If RSelenium works (opening a chrome browser), then the rest of this will run! Thanks!

I reccomend to:

  • install docker for Mac,

  • pull the image for chrome, firefox (recommend version 3.5.1) or phantom

  • run image in docker: docker run...

  • create remotedriver:

    remDr <- remoteDriver(remoteServerAddr = "here you IP", port = 4445L, browserName = "firefox")

  • if you have debug version you can watch in VNC what are you doing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM