RSelenium rsDriver对等SSL证书问题 [英] RSelenium rsDriver peer SSL certificate issue

查看:106
本文介绍了RSelenium rsDriver对等SSL证书问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试学习使用RSelenium。我坚持尝试使用rsDriver启动服务器。我只是试图运行下面的代码,并收到以下错误:

I am trying to learn using RSelenium. I am stuck with just trying to start the server using rsDriver. I am simply trying to run the code below and got the following error:

rD <- rsDriver()
checking Selenium Server versions:
BEGIN: PREDOWNLOAD
Error in open.connection(con, "rb") : 
  Peer certificate cannot be authenticated with given CA certificates

我在堆栈溢出附近进行搜索,发现我们可以使用以下方法为rsDriver提供选项,但我仍然出错:

I searched around stack overflow and found out we can give options to rsDriver using below but I still got error:

my_extra <- list("--ignore-ssl-errors=true", "--ssl-protocol=tlsv1", "--web-security=no")
rs <- rsDriver(extraCapabilities = my_extra)
checking Selenium Server versions:
BEGIN: PREDOWNLOAD
Error in open.connection(con, "rb") : 
  Peer certificate cannot be authenticated with given CA certificates

我还有其他东西吗

对于httr :: GET函数,我可以使用以下方法绕过SSL证书:

for httr::GET function, I am able to bypass the SSL Certificate using:

set_config(config(ssl_verifypeer=0L)). 

但是此方法不适用于RSelenium :: rsDriver。

But this method does not work for RSelenium::rsDriver.

这是我的系统规格:
我的操作系统:Microsoft Windows 10

Here is my system spec: My OS: Microsoft Windows 10

R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] RCurl_1.95-4.8  bitops_1.0-6    httr_1.2.1      wdman_0.2.2    
[5] RSelenium_1.7.1

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.12     XML_3.98-1.9     binman_0.1.0     assertthat_0.2.0
 [5] R6_2.2.2         jsonlite_1.5     semver_0.2.0     curl_2.7        
 [9] tools_3.4.1      yaml_2.1.14      compiler_3.4.1   caTools_1.17.1  
[13] openssl_0.9.6


推荐答案

rsDriver 使用binman软件包以处理相关二进制文件的下载。硒项目在 https:// www的JSON文件中列出其版本。 .googleapis.com / storage / v1 / b / selenium-release / o
如果尝试以下操作,应该遇到相同的问题:

rsDriver uses the binman package to handle the downloading of relevant binaries. The selenium project lists its release in a JSON file at https://www.googleapis.com/storage/v1/b/selenium-release/o You should have the same issue if you try:

jsonlite::fromJSON("https://www.googleapis.com/storage/v1/b/selenium-release/o")

您可以使用以下方法模拟相关的 curl 资金

You can mock the relevant curl fundtion using something like:

my_new_handle <- function(...){
  print("mocking")
  h <- .Call(curl:::R_new_handle, PACKAGE = "curl")
  curl:::handle_setopt(h, ..., ssl_verifypeer = FALSE)
  h
}
testthat::with_mock(
  `curl::new_handle` = my_new_handle,
  {
    selCommand <- httr::with_config(config(ssl_verifypeer=0L),wdman::selenium(‌​retcommand=TRUE))
  }
)

这篇关于RSelenium rsDriver对等SSL证书问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆