简体   繁体   中英

RSelenium with RSDriver. Error: httr output: Failed to connect to localhost port 4445: Connection refused

I am trying to use RSelenium for webscraping. I am following the basics tutorial as explained on cran . The recommended approach is to install Docker (see tutorial as well as this stackoverflow answer). If I understand correctly, this is not an option for me as I am operating on Windows 7 for which Docker seems not to be available (see docker forum ).

Thus, I am trying option 2 using the RSDriver. I run

RSelenium::rsDriver()

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

and get the error

> remDr$open()
[1] "Connecting to remote server"
Error in checkError(res) : 
  Undefined error in httr call. httr output: Failed to connect to localhost port 4445: Connection refused

This question has been asked and answered before here , here , here and here , though these are about the same error when using Docker and their solutions did not work for me.

Is there anyway to get this running with rsDriver ? Is there any option for me as a Windows 7 user?

With RSelenium version 1.7.7 this is a workaround:

library(RSelenium)

remDr <- rsDriver(
  port = 4445L,
  browser = "firefox"
)

This command combines the server setup, and driver initation.

My issue (on Mac) was updating Java:

https://www.oracle.com/java/technologies/downloads/#jdk19-mac

Worked after this.

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