Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Rselenium #9

Closed
msgoussi opened this issue Feb 7, 2017 · 11 comments
Closed

Using Rselenium #9

msgoussi opened this issue Feb 7, 2017 · 11 comments

Comments

@msgoussi
Copy link

@msgoussi msgoussi commented Feb 7, 2017

Please fill the following template:

Operating System

windows 10

Please describe Expected behaviour

Please describe Actual behaviour

Steps to reproduce the behaviour

wdman::selenium(retcommand = TRUE)
checking Selenium Server versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking chromedriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking geckodriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking phantomjs versions:
BEGIN: PREDOWNLOAD
Error in open.connection(con, "rb") :
Peer certificate cannot be authenticated with given CA certificates

binman::list_versions("geckodriver")
$win64
[1] "0.11.1" "0.12.0" "0.13.0" "0.14.0"

is there a way to solve this problem!!!!
via downloading and installing phantomjs manually.

@johndharrison
Copy link
Member

@johndharrison johndharrison commented Feb 7, 2017

@msgoussi can you try running the command as follows:

selCommand <-  httr::with_config(httr::config( ssl_verifypeer = 0L ), wdman::selenium(retcommand = TRUE))

or you can set session wide:

httr::set_config(httr::config(ssl_verifypeer = 0L))
selCommand <-  wdman::selenium(retcommand = TRUE)

@msgoussi
Copy link
Author

@msgoussi msgoussi commented Feb 7, 2017

I know it is network issue, since our IT team is having an aggressive firewall because the virus attach on Saudi Arabia, so I am trying to solve this problem via them.

@johndharrison
Copy link
Member

@johndharrison johndharrison commented Feb 7, 2017

The YAML file outlining the download of phantomjs is as follows:

> readLines(system.file("yaml", "phantomjs.yml", package = "wdman"))
 [1] "name: phantomjs"                                                                          
 [2] "predlfunction:"                                                                           
 [3] "  \"binman::predl_bitbucket_downloads\":"                                                 
 [4] "    url: https://api.bitbucket.org/2.0/repositories/ariya/phantomjs/downloads?pagelen=100"
 [5] "    platform:"                                                                            
 [6] "    - linux64"                                                                            
 [7] "    - linux32"                                                                            
 [8] "    - windows"                                                                            
 [9] "    - macosx"                                                                             
[10] "    history: 3"                                                                           
[11] "    appname: \"phantomjs\""                                                               
[12] "    platformregex:"                                                                       
[13] "    - \"(?!.*-symbols)linux-x86_64\""                                                     
[14] "    - \"(?!.*-symbols)linux-i686\""                                                       
[15] "    - \"windows\""                                                                        
[16] "    - \"(?!.*-symbols)macos\""                                                            
[17] "dlfunction:"                                                                              
[18] "  \"binman::download_files\": []"                                                         
[19] "postdlfunction:"                                                                          
[20] "  \"binman::unziptar_dlfiles\":"                                                          
[21] "    chmod: TRUE"  

It calls bitbucket:

https://api.bitbucket.org/2.0/repositories/ariya/phantomjs/downloads?pagelen=100

so looks like the issues are with the certificates being used for this site.

I am guessing this command

bburl <- "https://api.bitbucket.org/2.0/repositories/ariya/phantomjs/downloads?pagelen=100"
jsonlite::fromJSON(bburl)

is returning the error.

@msgoussi
Copy link
Author

@msgoussi msgoussi commented Feb 7, 2017

Yes indeed, it is returning error and I am stuck.

@johndharrison
Copy link
Member

@johndharrison johndharrison commented Feb 7, 2017

Unfortunately jsonlite::fromJSON does not pass options to the underlying curl package which is performing the download. You can try mocking the curl::new_handle function:

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 <-  wdman::selenium(retcommand = TRUE)
  }
)

@msgoussi
Copy link
Author

@msgoussi msgoussi commented Feb 7, 2017

It is not working, but IT team will work on it today and I will inform you with the updates.
Sorry for disturbing you

@msgoussi
Copy link
Author

@msgoussi msgoussi commented Feb 7, 2017

IT team worked on the problem as follows:
they managed to run the following commands without any problems
readLines(system.file("yaml", "phantomjs.yml", package = "wdman"))
bburl <- "https://api.bitbucket.org/2.0/repositories/ariya/phantomjs/downloads?pagelen=100"
jsonlite::fromJSON(bburl)

however when i run
wdman::selenium(retcommand = TRUE)
checking Selenium Server versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking chromedriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking geckodriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking phantomjs versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
Error in if (file.access(phantompath, 1) < 0) { :
argument is of length zero

I opened the folder C:\Users\310677\AppData\Local\binman\binman_phantomjs\windows
I found three folders (2.0.0, 2.1.1 and 2.5.0) which contanis phantomjs-version-windows zip file with size 0KB.

Please advice.

@msgoussi msgoussi closed this as completed Feb 7, 2017
@msgoussi msgoussi reopened this Feb 7, 2017
@johndharrison
Copy link
Member

@johndharrison johndharrison commented Feb 7, 2017

Try removing the phantomjs versions and retrying:

binman::rm_platform("phantomjs")
wdman::selenium(retcommand = TRUE)

If the error persists something is blocking/impeding the download of the zip files from url's such as:

https://api.bitbucket.org/2.0/repositories/ariya/phantomjs/downloads/phantomjs-2.0.0-windows.zip

@msgoussi
Copy link
Author

@msgoussi msgoussi commented Feb 7, 2017

John
I run httr::with_config(config(ssl_verifypeer=0L),wdman::selenium(retcommand=TRUE))
and it downloading three different version of phantomjs
and it working.
Tomorrow, I will test the rsDriver()
Thank you very much for your support and help.

@johndharrison
Copy link
Member

@johndharrison johndharrison commented Feb 7, 2017

Happy to help

@Andrevw2812
Copy link

@Andrevw2812 Andrevw2812 commented Jan 31, 2022

Try removing the phantomjs versions and retrying:

binman::rm_platform("phantomjs")
wdman::selenium(retcommand = TRUE)

If the error persists something is blocking/impeding the download of the zip files from url's such as:

https://api.bitbucket.org/2.0/repositories/ariya/phantomjs/downloads/phantomjs-2.0.0-windows.zip

I know this is a long time after this issue was raised, but this actually helped me and resolved my problems. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants