1

I am attempting to run RSelenium behind my company's proxy and can connect successfully via GET requests, but I am unable to properly run the rsDriver() function.

set_config(use_proxy(url = "proxy.company.com",
                     port = 80,
                     username = "greg",
                     password = "password"))

Upon doing this, I am successfully able to run a GET request, which I am unable to perform without using setconfig:

> GET("http://google.com")
Response [http://www.google.com/]
  Date: 2021-02-09 18:30
  Status: 200

I try using rsDriver and get a connection issue with either Chrome or Firefox:

cprof <- list(chromeOptions = 
                list(args = list("--proxy-server=proxy.company.com")))

driver <- rsDriver(browser = c("chrome"), extraCapabilities = cprof)

checking Selenium Server versions: BEGIN: PREDOWNLOAD Error in open.connection(con, "rb") : Timeout was reached: [www.googleapis.com] Operation timed out after 10014 milliseconds with 0 out of 0 bytes received

I alternatively try to run with a Docker client, and I get a strange message after trying to connect:

> remDr <- remoteDriver(remoteServerAddr = "127.0.0.1", port = 444L) 
> remDr$open()
[1] "Connecting to remote server"
$id
[1] NA

I am puzzled as to why I cannot get this to work, no matter what I try. Any guidance would be life saving.

THANK YOU

1 Answers1

0

This is a hard problem to search for, since the resulting error is literally just NA. But I found this on how to use a proxy with RSelenium. Basically:

cprof <- list(chromeOptions = 
                  list(args = list("--proxy-server=http://118.69.61.212:53281")))

driver<- rsDriver(browser=c("chrome"), extraCapabilities = cprof)
driver$client$navigate("http://ipinfo.io")

But you have a hard coded username and password, which is seems is not possible to use with chrome, due to security reasons.

However, someone made a script that can make it work (I haven't attempted to use it, let alone with R, very interested to hear if someone can make it work).

For what it's worth, I faced all the same problems, so I made requests via httr/rvest behind a proxy, but for requests via RSelenium, I used httr::reset_config() to stop using proxies so at least RSelenium worked (that's not a solution to this problem, just a comprimise).

stevec
  • 41,291
  • 27
  • 223
  • 311