RSelenium behind proxy

前端 未结 2 593
遇见更好的自我
遇见更好的自我 2020-12-30 15:29

I am trying to use RSelenium. Here is what I am doing:

library(RSelenium)  
driver<- rsDriver(browser=c(\"chrome\"))
remDr <- driver[[\"client\"]]
remD         


        
相关标签:
2条回答
  • 2020-12-30 16:05

    You need to use extraCapabilities and set the proxy using the same

    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")
    

    And you can see that chrome now uses the proxy config

    0 讨论(0)
  • 2020-12-30 16:24

    I use RSelenium with Docker.

    Here is mine option:

    # connect to docker. 
    # need to run in terminal (ctrl + alt + enter)
    docker run -d -p  4445:4444 selenium/standalone-chrome:3.5.3
    eCap <- list(chromeOptions = 
                 list(args = list("--proxy-server=http://47.254.69.158:9999")))
    remDr <- remoteDriver(remoteServerAddr = "localhost",
                      port = 4445L,
                      browserName = "chrome",
                      extraCapabilities = eCap)
    remDr$open()
    remDr$navigate("https://ipinfo.io/")
    remDr$screenshot(display = TRUE)
    

    So i got this this

    If you still have troubles try to switch to other proxy and/or reload Docker.

    Hope this will be usefull.

    0 讨论(0)
提交回复
热议问题