Code Monkey home page Code Monkey logo

wdman's Introduction

wdman

R-CMD-check codecov

Introduction

wdman (Webdriver Manager) is an R package that allows the user to manage the downloading/running of third party binaries relating to the webdriver/selenium projects. The package was inspired by a similar node package webdriver-manager.

The checking/downloading of binaries is handled by the binman package, and the running of the binaries as processes is handled by the subprocess package.

The wdman package currently manages the following binaries:

Associated with the above are five functions to download/manage the binaries:

  • selenium(...)
  • chrome(...)
  • phantomjs(...)
  • gecko(...)
  • iedriver(...)

Installation

You can install wdman from GitHub with:

# install.packages("remotes")
remotes::install_github("ropensci/wdman")

The package can also be installed from CRAN:

install.packages("wdman")

Example

As an example, we show how one would run the Selenium standalone binary as a process:

Running the Selenium binary

The binary takes a port argument which defaults to port = 4567L. There are a number of optional arguments to use a particular version of the binaries related to browsers selenium may control. By default, the selenium function will look to use the latest version of each.

selServ <- selenium(verbose = FALSE)
selServ$process

## PROCESS 'file50e6163b37b8.sh', running, pid 21289.

The selenium function returns a list of functions and a handle representing the running process.

The returned output, error and log functions give access to the stdout/stderr pipes and the cumulative stdout/stderr messages respectively.

selServ$log()

## $stderr
## [1] "13:25:51.744 INFO [GridLauncherV3.parse] - Selenium server version: 4.0.0-alpha-2, revision: f148142cf8"         
## [2] "13:25:52.174 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4567"
## [3] "13:25:54.018 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet"                                     
## [4] "13:25:54.539 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4567"                        

## $stdout
## character(0)

The stop function sends a signal that terminates the process:

selServ$stop()

## TRUE

Available browsers

By default, the selenium function includes paths to chromedriver/geckodriver/phantomjs so that the Chrome/Firefox and PhantomJS browsers are available respectively. All versions (chromever, geckover etc) are given as "latest". If the user passes a value of NULL for any driver, it will be excluded.

On Windows operating systems, the option to included the Internet Explorer driver is also given. This is set to iedrver = NULL so not ran by default. Set it to iedrver = "latest" or a specific version string to include it on your Windows.

Further details

For further details, please see the package vignette.


wdman's People

Contributors

jeffreyblewis avatar jeroen avatar johndharrison avatar jonathanvoelkle avatar juyeongkim avatar mfpole avatar mnel avatar vjcitn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

wdman's Issues

Could not find or load main class c(-Dwebdriver.chrome.driver ...

Please fill the following template:

Operating System

Windows 10

Please describe Expected behaviour

I'm trying to setup a selenium server in R using the provided vignette

Please describe Actual behaviour

I'm getting the following errors

x = wdman::selenium(verbose = FALSE, check = FALSE)
x$log()

#$stderr
#[1] "Error: Could not find or load main class c(-Dwebdriver.chrome.driver=\"C:\\\\Users\\\\PJ Van Camp\\\\AppData\\\\Local\\\\binman\\\\binman_chromedriver\\\\win32\\\\111.0.5563.41.chromedriver.exe\","

#$stdout
#character(0)

I tried changing the chrome versions, but getting the same error.
I have no idea why this is happening so I'm afraid I cannot provide any more details.
The only thing I thought might be an issue is the space in the path, but it's quoted so that should be OK...

I also tried running a standalone Selenium server with Java, which is working (if I browse to the IP server address), but then trying to connect to it through R does not work either

> remDr <- RSelenium::remoteDriver(
+   remoteServerAddr = "172.31.160.1",
+   port = 4444L,
+   browserName = "chrome"
+ )
> remDr$open()
[1] "Connecting to remote server"
$id
[1] NA

Thanks for your help!
PJ

unable to download files in headless chrome

trying to reproduce these steps in wdman startup to get around headless chrome 59 bug

https://bugs.chromium.org/p/chromium/issues/detail?id=696481#c80

Operating System

macOS

binman::list_versions('chromedriver')
$mac64
[1] "2.38" "2.39" "2.40" "2.41"
Session Info
> devtools::session_info()
Session info --------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.5.0 (2018-04-23)
 system   x86_64, darwin15.6.0        
 ui       RStudio (1.2.779)           
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       America/New_York            
 date     2018-07-29                  

Packages ------------------------------------------------------------------------------------------
 package     * version   date       source                             
 assertthat    0.2.0     2017-04-11 CRAN (R 3.5.0)                     
 base        * 3.5.0     2018-04-24 local                              
 base64enc     0.1-3     2015-07-28 CRAN (R 3.5.0)                     
 binman        0.1.1     2018-07-18 cran (@0.1.1)                      
 bitops        1.0-6     2013-08-17 CRAN (R 3.5.0)                     
 caTools       1.17.1.1  2018-07-20 cran (@1.17.1.)                    
 clipr         0.4.1     2018-06-23 CRAN (R 3.5.0)                     
 compiler      3.5.0     2018-04-24 local                              
 curl          3.2       2018-03-28 CRAN (R 3.5.0)                     
 datasets    * 3.5.0     2018-04-24 local                              
 devtools      1.13.5    2018-02-18 CRAN (R 3.5.0)                     
 digest        0.6.15    2018-01-28 CRAN (R 3.5.0)                     
 graphics    * 3.5.0     2018-04-24 local                              
 grDevices   * 3.5.0     2018-04-24 local                              
 htmltools     0.3.6     2017-04-28 CRAN (R 3.5.0)                     
 htmlwidgets   1.2       2018-04-19 CRAN (R 3.5.0)                     
 httr          1.3.1     2017-08-20 CRAN (R 3.5.0)                     
 jsonlite      1.5       2017-06-01 CRAN (R 3.5.0)                     
 knitr         1.20      2018-02-20 CRAN (R 3.5.0)                     
 magick        1.9       2018-05-11 CRAN (R 3.5.0)                     
 magrittr      1.5       2014-11-22 CRAN (R 3.5.0)                     
 memoise       1.1.0     2017-04-21 CRAN (R 3.5.0)                     
 methods     * 3.5.0     2018-04-24 local                              
 openssl       1.0.1     2018-03-03 CRAN (R 3.5.0)                     
 R6            2.2.2     2017-06-17 CRAN (R 3.5.0)                     
 rappdirs      0.3.1     2016-03-28 cran (@0.3.1)                      
 Rcpp          0.12.18   2018-07-23 CRAN (R 3.5.0)                     
 RSelenium   * 1.7.3     2018-07-27 Github (ropensci/RSelenium@088db87)
 rsvg          1.3       2018-05-10 CRAN (R 3.5.0)                     
 semver        0.2.0     2017-01-06 cran (@0.2.0)                      
 slickR        0.3       2018-07-09 local                              
 stats       * 3.5.0     2018-04-24 local                              
 subprocess    0.8.2     2017-10-22 cran (@0.8.2)                      
 tools         3.5.0     2018-04-24 local                              
 utils       * 3.5.0     2018-04-24 local                              
 wdman       * 0.2.4     2018-07-21 cran (@0.2.4)                      
 withr         2.1.2     2018-03-15 CRAN (R 3.5.0)                     
 XML           3.98-1.12 2018-07-15 cran (@3.98-1.)                    
 xml2          1.2.0     2018-01-24 CRAN (R 3.5.0)                     
 yaml          2.2.0     2018-07-25 CRAN (R 3.5.0) 

Please describe Expected behaviour

trying to download file via RSelenium using headless chrome

Please describe Actual behaviour

no download is executed

Steps to reproduce the behaviour

eCaps <- list(
  chromeOptions = list(
    args = c('--headless','--disable-gpu', '--window-size=1280,800'),
    prefs = list(
      "profile.default_content_settings.popups" = 0L,
      "download.prompt_for_download" = FALSE,
      "download.default_directory" = getwd()
    )
  )
)  

cDrv <- wdman::chrome()

rD <- RSelenium::rsDriver(extraCapabilities = eCaps)

remDr <- rD$client

remDr$navigate('https://github.com/yonicd/covrpage/blob/master/R/sysdata.rda')

Sys.sleep(2)

webElem <- remDr$findElement(using = 'xpath',value = '//*[@id="raw-url"]')

webElem$clickElement()

list.files(getwd(),pattern = 'sysdata')

remDr$closeall()

cDrv$stop()

Run RSelenium through wdman in parallel

Operating System

Windows

Please describe Expected behaviour

parallel execution

Please describe Actual behaviour

one sequential execution

Steps to reproduce the behaviour

parallelize

Hi,

I would like to know is it possible to ran RSelenium via wdman in parallel.

For example, usual way to run phantom through wdman:

pjs <- wdman::phantomjs()
remDr <- remoteDriver(browserName = "phantomjs", port = 4567L)
remDr$open()
....
....

Is it possible to runa code in parallel in a way that I can have multiple tests?
For example something like:

(cl <- (detectCores() - 1) %>%  makeCluster) %>% registerDoParallel

    clusterEvalQ(cl, {
    library(RSelenium)
    library(XML)
    library(rvest)
    library(imager)
    library(reticulate)
    
    remDr <- remoteDriver(remoteServerAddr = "xxxxx", port = xxxxL,
                          browserName = "firefox")
    remDr$open()
    })

Starting with 0.27.0, the geckodriver binaries for Linux have .asc files, the presence of which breaks downloads

Please fill the following template:

Operating System

Any Linux

Please describe Expected behaviour

geckodriver version 0.27.0 and newer can be downloaded.

Please describe Actual behaviour

Downloading fails with the error

checking geckodriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
Creating directory: /mnt/home/jss/.local/share/binman_geckodriver/linux64/0.29.0
Downloading binary: https://github.com/mozilla/geckodriver/releases/download/v0.29.0/geckodriver-v0.29.0-linux64.tar.gz

Downloading binary: https://github.com/mozilla/geckodriver/releases/download/v0.29.0/geckodriver-v0.29.0-linux64.tar.gz.asc

Creating directory: /mnt/home/jss/.local/share/binman_geckodriver/linux64/0.28.0
Downloading binary: https://github.com/mozilla/geckodriver/releases/download/v0.28.0/geckodriver-v0.28.0-linux64.tar.gz

BEGIN: POSTDOWNLOAD
Error in (function (platform, file, processed, chmod)  : 
  /mnt/home/jss/.local/share/binman_geckodriver/linux64/0.29.0/geckodriver-v0.29.0-linux64.tar.gz.asc does not appear to be a zip or tar file.

Steps to reproduce the behaviour

On a Linux machine (not macOS):

install.packages("RSelenium")
rD <- RSelenium::rsDriver(browser = "phantomjs")

ARM64 version of Linux Chromedriver: "Timed out waiting for driver server to start."

I know, there is nothing you can do until Google releases the ChromeDriver for linux-arm64, but I wanted to open this to let people know what is happening when they search for this.

I get the "Connecting to remote server' time out error, because while it can start the java selenium server, it can't start the linux64 chromedriver. That is the wrong exec format (being for X64, not ARM64)

Operating System

Ubuntu 24.04 LTS on arm64

Please describe Expected behaviour

Chromedriver should start and RSelenium should work

Please describe Actual behaviour

[1] "Connecting to remote server"

Selenium message:Timed out waiting for driver server to start.
Build info: version: '4.0.0-alpha-2', revision: 'f148142cf8', time: '2019-07-01T21:30:10'
System info: host: 'ubuvm', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'aarch64', os.version: '6.8.0-35-generic', java.version: '21.0.3'
Driver info: driver.version: unknown

Could not open chrome browser.
Client error message:
	 Summary: UnknownError
 	 Detail: An unknown server-side error occurred while processing the command.
	 Further Details: run errorDetails method
Check server log for further details.
[1] "Connecting to remote server"

Selenium message:Timed out waiting for driver server to start.
Build info: version: '4.0.0-alpha-2', revision: 'f148142cf8', time: '2019-07-01T21:30:10'
System info: host: 'ubuvm', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'aarch64', os.version: '6.8.0-35-generic', java.version: '21.0.3'
Driver info: driver.version: unknown

Error: 	 Summary: UnknownError
 	 Detail: An unknown server-side error occurred while processing the command.
	 Further Details: run errorDetails method

Steps to reproduce the behaviour

library(rvest)
library(RSelenium)

remDr <- rsDriver(
  browser = c('chrome'),
  port = 4444L,
  check = TRUE,
  verbose = TRUE
)
brow <- remDr[["client"]]

brow$open()

downloading phantom but unzipped

Please fill the following template:

Windows 10

run rsDriver(verbose = FALSE)

error: because length(phantompath) is 0

run rsDriver again


phantom_ver <- function(platform, version){
  phantomver <- binman::list_versions("phantomjs")[[platform]]
  phantomver <- if(identical(version, "latest")){
    as.character(max(semver::parse_version(phantomver)))
  }else{
    mtch <- match(version, phantomver)
    if(is.na(mtch) || is.null(mtch)){
      stop("version requested doesnt match versions available = ",
           paste(phantomver, collapse = ","))
    }
    phantomver[mtch]
  }
  phantomdir <- normalizePath(
    file.path(app_dir("phantomjs"), platform, phantomver)
  )
  phantompath <- list.files(phantomdir,
                            pattern = "phantomjs($|\\.exe$)",
                            recursive = TRUE,
                            full.names = TRUE)
  if(file.access(phantompath, 1) < 0){
    Sys.chmod(phantompath, '0755')
  }
  list(version = phantomver, dir = phantomdir, path = phantompath)
}

After checking, I found this function, searches for a .exe file, but what was downloaded was still unzipped, I was wondering it that was the reason.

Unable to run rsDriver, SSL certification error after disabling verfiying

Operating System
Windows 7 Professional
R version 3.3.3

Expected behaviour
I would expect rsDriver to be able to have the chrome server running after the following commands:

library(RSelenium)
library(httr)
set_config(config(ssl_verifypeer = 0L))
rD <- rsDriver(verbose = FALSE)
rD

Actual behaviour
But I continued to get the SSL errror even after disabled the SSL verification

"Error in open.connection(con, "rb") :
Peer certificate cannot be authenticated with given CA certificates"

Any help is appreciated!

RSelenium wdman issue

Operating System

Windows 10
Rstudio 4.1.0.
R 1.4.113
Rselenium 1.7.7
wdman 0.2.5

Please describe Expected behaviour

When running:

library(RSelenium)
rD1 <- rsDriver(browser = "chrome", port=4567L, chromever='latest')

remDr1 <- rD1[["client"]]  

I expect to be able to close and free the port with:

remDr1$close()
rD1$server$stop() 
rm(rD1)
gc()

Please describe Actual behaviour

Doesn't free up the port. Attempting to close with above lines and re-running the client with the RSelenium lines creates warning:

Error in wdman::selenium(port = port, verbose = verbose, version = version,  : 
  Selenium server signals port = 4567 is already in use.

Previously I was able to close and free the port with the suggested lines.

This issue thread ropensci/RSelenium#228 (comment) indicates the workaround is to run:

system("taskkill /im java.exe /f", intern=FALSE, ignore.stdout=FALSE)

Which works to free up any port.

The same thread indicates that this might be a bug with wdman. Did something change in wdman functioning? Or is this really a Rselenium issue?

New mac64 chromedriver binary names lead to wrong binary being installed

Operating System

mac64 (intel)

Please describe Expected behaviour

wdman:::chrome_check(verbose=TRUE) should lead to the download of
chromedriver_mac64.zip and to the installation of the correct chromedriver binary.

Please describe Actual behaviour

wdman:::chrome_check(verbose=TRUE) now results in the download of both chromedriver_mac64.zip
and chromedriver_mac64_m1.zip. This, in turn, results in the installation of the chromedriver binary from chromedriver_mac64_m1.zip which does not run on intel-based macs (raising the error "java.io.IOException: Cannot run program" error when attempting to launch selenium). This problem is the result of the introduction of new binaries for Apple's M1 processor on https://www.googleapis.com/storage/v1/b/chromedriver/.

In order to make a proper fix one would need to know what the platform/architecture name for machines with the M1 chip is, which I don't, and then to make the necessary corrections to the regexs that determine which chromedriver zip files are downloaded.

In the meantime, I was able to get wdman::selenium (and, thus, Rselenium) to work by manually removing the *-m1.zip and then unzipping the *-mac64.zip found in ~/Library/Application Support/binman_chromedriver/mac64/VERSION_NUMBER/ thus putting in place the correct chromedriver binary for an Intel mac (and then, of course, being sure to set check=FALSE when running wdman::selenium(check=FALSE) or RSelenium::rsDriver(check=FALSE) so as not to overwrite my manual fix).

Steps to reproduce the behaviour

Executing,
wdman:::chrome_check(verbose=TRUE) on an intel-based mac64 computer.

Could Not Create Process / Access is denied

Please fill the following template:

Operating System

Windows 10

Please describe Expected behaviour

Task Scheduler runs batch script launching R script for execution.

Please describe Actual behaviour

Task Scheduler runs batch script which does launch the R script, but the execution fails when launching the chrome driver.

Steps to reproduce the behaviour

Scheduled task in Windows 10 launching R Script with underlying wdman/chrome driver instructions. Also had similar experience when attempting PhantomJS. Script runs fine when executing batch file outside of Task Scheduler. Attempted all kinds of modifications to ensure User has Administrative rights running batch with highest privileges.

Additional:
Error from Log:

Loading required package: rJava
Loading required package: xlsxjars
Error in subprocess::spawn_process(tfile, ...) :
could not create process: Access is denied
Calls: chrome ... spawn_tofile -> windows_spawn_tofile ->
Execution halted

Thanks for your efforts with this package which is fantastic. Appreciate any assistance or guidance you can offer. Regards, John

chrome not starting

Please fill the following template:

Operating System

Session info -------------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.5.1 (2018-07-02)
 system   x86_64, darwin15.6.0        
 ui       RStudio (1.2.1007)          
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       America/New_York            
 date     2018-10-01                  

Packages -----------------------------------------------------------------------------------------------------------------------
 package    * version date       source        
 assertthat   0.2.0   2017-04-11 CRAN (R 3.5.0)
 base       * 3.5.1   2018-07-05 local         
 binman       0.1.1   2018-07-18 CRAN (R 3.5.0)
 compiler     3.5.1   2018-07-05 local         
 curl         3.2     2018-03-28 CRAN (R 3.5.0)
 datasets   * 3.5.1   2018-07-05 local         
 devtools     1.13.6  2018-06-27 CRAN (R 3.5.0)
 digest       0.6.17  2018-09-12 CRAN (R 3.5.0)
 graphics   * 3.5.1   2018-07-05 local         
 grDevices  * 3.5.1   2018-07-05 local         
 httr         1.3.1   2017-08-20 CRAN (R 3.5.0)
 jsonlite     1.5     2017-06-01 CRAN (R 3.5.0)
 memoise      1.1.0   2017-04-21 CRAN (R 3.5.0)
 methods    * 3.5.1   2018-07-05 local         
 packrat      0.4.9-3 2018-06-01 CRAN (R 3.5.0)
 R6           2.2.2   2017-06-17 CRAN (R 3.5.0)
 rappdirs     0.3.1   2016-03-28 CRAN (R 3.5.0)
 Rcpp         0.12.18 2018-07-23 CRAN (R 3.5.0)
 semver       0.2.0   2017-01-06 CRAN (R 3.5.0)
 stats      * 3.5.1   2018-07-05 local         
 subprocess   0.8.3   2018-08-13 CRAN (R 3.5.0)
 tools        3.5.1   2018-07-05 local         
 utils      * 3.5.1   2018-07-05 local         
 wdman        0.2.4   2018-07-21 CRAN (R 3.5.0)
 withr        2.1.2   2018-03-15 CRAN (R 3.5.0)
 xml2         1.2.0   2018-01-24 CRAN (R 3.5.0)
 yaml         2.2.0   2018-07-25 CRAN (R 3.5.0)
>chromedriver -v
ChromeDriver 2.42.591059 (a3d9684d10d61aa0c45f6723b327283be1ebaad8)

Please describe Actual behaviour

> wdman::chrome()
checking chromedriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
Error in subprocess::process_kill(chromedrv) : 
  system kill() failed: Operation not permitted

Curl error when downloading Selenium standalone using selenium() function

Operating System

Ubuntu 18.04.6 LTS

Please describe Expected behaviour

Using selenium() function to download and run the Selenium binary.

Please describe Actual behaviour

The function apparently downloads a file that cannot be decompressed with the (latest) curl package. Curl throws an error that "Unrecognized content encoding type. libcurl understands deflate, gzip content encodings," and I end up with an empty selenium-server-standalone-4.0.0-alpha-2.jar file.

Steps to reproduce the behaviour

> library(wdman)
> selenium(verbose = TRUE)
checking Selenium Server versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
Creating directory: ~/.local/share/binman_seleniumserver/generic/4.0.0-alpha-1
Downloading binary: https://www.googleapis.com/download/storage/v1/b/selenium-release/...

Error in curl::curl_fetch_disk(url, x$path, handle = handle) : 
  Unrecognized content encoding type. libcurl understands deflate, gzip content encodings.

> file.size('~/.local/share/binman_seleniumserver/generic/4.0.0-alpha-1/selenium-server-standalone-4.0.0-alpha-1.jar') 
[1] 0

> devtools::session_info()
─ Session info ────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 4.1.1 (2021-08-10)
 os       Ubuntu 18.04.6 LTS          
 system   x86_64, linux-gnu           
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/Los_Angeles         
 date     2021-09-17                  

─ Packages ────────────────────────────────────────────────────────────────────────────────
 package     * version date       lib source        
 assertthat    0.2.1   2019-03-21 [2] CRAN (R 4.1.0)
 binman        0.1.2   2020-10-02 [1] CRAN (R 4.1.1)
 cachem        1.0.5   2021-05-15 [2] CRAN (R 4.1.0)
 callr         3.7.0   2021-04-20 [2] CRAN (R 4.1.0)
 cli           2.5.0   2021-04-26 [2] CRAN (R 4.1.0)
 crayon        1.4.1   2021-02-08 [2] CRAN (R 4.1.0)
 curl          4.3.2   2021-06-23 [1] CRAN (R 4.1.1)
 desc          1.3.0   2021-03-05 [2] CRAN (R 4.1.0)
 devtools      2.4.2   2021-06-07 [2] CRAN (R 4.1.0)
 ellipsis      0.3.2   2021-04-29 [2] CRAN (R 4.1.0)
 fastmap       1.1.0   2021-01-25 [2] CRAN (R 4.1.0)
 fs            1.5.0   2020-07-31 [2] CRAN (R 4.1.0)
 glue          1.4.2   2020-08-27 [2] CRAN (R 4.1.0)
 httr          1.4.2   2020-07-20 [2] CRAN (R 4.1.0)
 jsonlite      1.7.2   2020-12-09 [2] CRAN (R 4.1.0)
 lifecycle     1.0.0   2021-02-15 [2] CRAN (R 4.1.0)
 magrittr      2.0.1   2020-11-17 [2] CRAN (R 4.1.0)
 memoise       2.0.0   2021-01-26 [2] CRAN (R 4.1.0)
 pkgbuild      1.2.0   2020-12-15 [2] CRAN (R 4.1.0)
 pkgload       1.2.1   2021-04-06 [2] CRAN (R 4.1.0)
 prettyunits   1.1.1   2020-01-24 [2] CRAN (R 4.1.0)
 processx      3.5.2   2021-04-30 [2] CRAN (R 4.1.0)
 ps            1.6.0   2021-02-28 [2] CRAN (R 4.1.0)
 purrr         0.3.4   2020-04-17 [2] CRAN (R 4.1.0)
 R6            2.5.1   2021-08-19 [1] CRAN (R 4.1.1)
 rappdirs      0.3.3   2021-01-31 [2] CRAN (R 4.1.0)
 Rcpp          1.0.7   2021-07-07 [1] CRAN (R 4.1.1)
 remotes       2.4.0   2021-06-02 [2] CRAN (R 4.1.0)
 rlang         0.4.11  2021-04-30 [2] CRAN (R 4.1.0)
 rprojroot     2.0.2   2020-11-15 [2] CRAN (R 4.1.0)
 semver        0.2.0   2017-01-06 [1] CRAN (R 4.1.1)
 sessioninfo   1.1.1   2018-11-05 [2] CRAN (R 4.1.0)
 testthat      3.0.2   2021-02-14 [2] CRAN (R 4.1.0)
 usethis       2.0.1   2021-02-10 [2] CRAN (R 4.1.0)
 wdman       * 0.2.5   2020-01-31 [1] CRAN (R 4.1.1)
 withr         2.4.2   2021-04-18 [2] CRAN (R 4.1.0)
 xml2          1.3.2   2020-04-23 [2] CRAN (R 4.1.0)
 yaml          2.2.1   2020-02-01 [2] CRAN (R 4.1.0)

RSelenium Firefox Fails due to wdman

Operating System

Ubuntu 22.04

Please describe Expected behaviour

I am getting the error: Error in wdman::selenium(port = port, verbose = verbose, version = version, :
Selenium server couldn't be started

Steps to reproduce the behaviour

library(wdman)
rd <- selenium()

Ask for latest compatible driver?

Please fill the following template:

Operating System:

MacOS 10.13.6

Please describe Expected behaviour

I'm trying to use RSelenium to drive Google Chrome. For a long time I've had chromever="latest"
in the RSelenium::rsDriver call; it passes the version to wdman::selenium, and that opens the driver.

Please describe Actual behaviour

Today the latest Chrome driver is 74.0.3729.6, which doesn't work with my Chrome 73.0.3683.75, so the rsDriver call fails. Here's what I see:

> RSelenium::rsDriver(verbose = TRUE, 
+                                port = 4567L, 
+                                chromever="latest",
+                                geckover = NULL, 
+                                phantomver = NULL)
checking Selenium Server versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking chromedriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
[1] "Connecting to remote server"

Selenium message:session not created: This version of ChromeDriver only supports Chrome version 74
  (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Mac OS X 10.13.6 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.16 seconds
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'djmair3.local', ip: 'fe80:0:0:0:86b:ea4d:a09e:1599%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_71'
Driver info: driver.version: unknown

Could not open chrome browser.
Client error message:
	 Summary: SessionNotCreatedException
 	 Detail: A new session could not be created.
	 Further Details: run errorDetails method
Check server log for further details.
$client
[1] "No sessionInfo. Client browser is mostly likely not opened."

$server
Process Handle
command   : /private/var/folders/d6/s97fjjxd3_9353x_lwb692100000gn/T/RtmpDGdXRU/file606c956632.sh 
system id : 1563
state     : running

Is there some way to say "the latest compatible version" instead of the "latest"?

Steps to reproduce the behaviour

I think the only thing necessary is to try to open the latest chromedriver on a system that doesn't have Chrome 74.x.

Bug in java_check

Hi, I think I noticed a small bug in java_check function from selenium.R:

java_check <- function(){
  javapath <- Sys.which("java")
  if(identical(javapath, "")){
    stop("PATH to JAVA not found. Please check JAVA is installed.")
  }
  javapath
}

Sys.which always returns named vector, so condition in if statement always evaluates to False, even if Java is not defined in the PATH. It resulted in not very informative error, when I tried to run selenium() function on machine with no Java in the system path.

Unable to run Selenium server using rsDriver function

Please fill the following template:

OS

Windows 8.1 Pro, 64 bit
Running R version 3.2.2

Expected behaviour

I want to run RSelenium for the first time (the end goal is to use it for web scraping). I cannot use Docker because it requires Windows 10. Hence I tried to follow the instructions on the RSeleneium vignette for using the rsDriver function to run a Selenium Server.

Actual behaviour and steps to reproduce:

When I run the command
rD<-rsDriver(verbose=FALSE)
I get the following error dialogue popping up:

The procedure entry point R_GetConnection could not be located in the dynamic link library C:/Users/tom/Documents/R/win-library/3.2/jsonlite/libs/i386/jsonlite.dll

The error message in the R Console itself is:

Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'C:/Users/tom/Documents/R/win-library/3.2/jsonlite/libs/i386/jsonlite.dll':
LoadLibrary failure: The specified procedure could not be found.

That file does exist in that folder however.

As a Plan B, I tried to download a Selenium Server binary (2.53.0) and run the jar. I then ran the following R code:
remDr<-remoteDriver$new() remDr$open()

This yielded the same error dialogue and the following error in the R Console:

"Connecting to remote server"
Error in checkError(res) :
Undefined error in httr call. httr output: unable to load shared object 'C:/Users/tom/Documents/R/win-library/3.2/jsonlite/libs/i386/jsonlite.dll':
LoadLibrary failure: The specified procedure could not be found.

Assistance is greatly appreciated since I am well versed in R but not in web interfacing.

Using Rselenium

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.

Unable to download selenium server

Operating System
Mac 10.12
R version 3.4.0

Expected behaviour
I would expect rsDriver to be able to have the chrome server running after the following commands:

library(RSelenium)
rD <- rsDriver()

But I continued to get error

checking Selenium Server versions:
BEGIN: PREDOWNLOAD
Error in open.connection(con, "rb") : Timeout was reached

Any help is appreciated!

the problem of rsDriver

Please fill the following template:

Operating System

Win10
R x64 3.3.3

Please describe Expected behaviour

I ran the selenium-server-standalone-3.3.1.jar by windows cmd,and it is running.
then I want to run firefox by using following command :
library(RSelenium)
rsDriver(browser = "firefox")

Please describe Actual behaviour

checking Selenium Server versions:
BEGIN: PREDOWNLOAD
Error in open.connection(con, "rb") : Couldn't connect to server
Uploading 1.png…
Uploading 2.png…

Issue with windows and firefox in rstudio

library(RSelenium)
library(wdman)
selServ <- selenium()
remDr <- remoteDriver(port = 4567L)
remDr$open()

Results in selenium hanging when all done from the same rstudio session. If the selServ call and remoteDriver call are done in different sessions no issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.