RSelenium rsDriver对等SSL证书问题

时间:2017-07-25 03:58:43

标签: r selenium ssl connection certificate

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

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

我搜索了堆栈溢出,发现我们可以使用下面给rsDriver选项,但我仍然有错误:

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证书
set_config(config(ssl_verifypeer=0L)). 

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

这是我的系统规格: 我的操作系统: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

1 个答案:

答案 0 :(得分:2)

rsDriver使用binman包来处理相关二进制文件的下载。 selenium项目在https://www.googleapis.com/storage/v1/b/selenium-release/o的JSON文件中列出了它的发布 如果你尝试,你应该有同样的问题:

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

您可以使用类似的内容mock curl 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)) } ) 基金。

DECLARE @in string = "system/dbotable{*}.tsv";
DECLARE @out string ="system/temp.tsv";

@searchlog =
    EXTRACT 
        Id         int,
        Address    string,
        number     int
    FROM @in
    USING Extractors.Tsv();

@transactions =
    SELECT 
        *,
        ROW_NUMBER() 
            OVER(PARTITION BY Id ORDER BY Id DESC) AS RowNumber
    FROM @searchlog;

@result =
    SELECT 
        Id ,
        Address,
        number 
    FROM @transactions
    WHERE RowNumber == 1;

OUTPUT @result
    TO @out
    USING Outputters.Tsv();