skip to Main Content

I am trying to run RSelenium on an AWS but I am running into some errors (I previously had it working on a different AWS (no longer available)).

I am getting the following error:

> library(tidyverse)
> library(RSelenium)
> 
> rD <- RSelenium::rsDriver(
+   port = 4454L,
+   browser = c("firefox"),
+   version = "latest"
+ )
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
[1] "Connecting to remote server"
Could not open firefox browser.
Client error message:
Undefined error in httr call. httr output: Failed to connect to localhost port 4454 after 0 ms: Connection refused
Check server log for further details.
Warning message:
In RSelenium::rsDriver(port = 4454L, browser = c("firefox"), version = "latest") :
  Could not determine server status.
[1] "Connecting to remote server"
Could not open firefox browser.
Client error message:
Undefined error in httr call. httr output: Failed to connect to localhost port 4454 after 0 ms: Connection refused
Check server log for further details.
Warning message:
In RSelenium::rsDriver(port = 4454L, browser = c("firefox"), version = "latest") :
  Could not determine server status.

I have tried following a number of online SO sugestions without luck.

Other things I have run (in the terminal)

ubuntu@ip-172-31-36-112:~$ whereis java
java: /usr/bin/java /usr/share/java /usr/share/man/man1/java.1.gz

ubuntu@ip-172-31-36-112:~$ java -version
openjdk version "11.0.17" 2022-10-18
OpenJDK Runtime Environment (build 11.0.17+8-post-Ubuntu-1ubuntu222.04)
OpenJDK 64-Bit Server VM (build 11.0.17+8-post-Ubuntu-1ubuntu222.04, mixed mode, sharing)

IN R I have run the following:

> sel = wdman::selenium()
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
> sel$process
PROCESS 'file269f704d94ce.sh', finished.
> sel$output()
character(0)
> sel$error()
character(0)
> sel$stop()
[1] FALSE
> sel$log()
$stderr
[1] ""

$stdout
[1] ""

I get slightly more info running:

> rsDriver(port = 4567L,
+          browser = c("chrome", "firefox", "phantomjs", "internet explorer"),
+          version = "latest",
+          chromever = "latest",
+          geckover = "latest",
+          iedrver = NULL,
+          phantomver = "2.1.1",
+          verbose = TRUE,
+          check = 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
[1] "Connecting to remote server"
Could not open chrome browser.
Client error message:
Undefined error in httr call. httr output: Failed to connect to localhost port 4567 after 0 ms: Connection refused
Check server log for further details.
$client
[1] "No sessionInfo. Client browser is mostly likely not opened."

$server
PROCESS 'file269f1793fdb5.sh', finished.
Warning message:
In rsDriver(port = 4567L, browser = c("chrome", "firefox", "phantomjs",  :
  Could not determine server status.
$client
[1] "No sessionInfo. Client browser is mostly likely not opened."

Session Info

> sessionInfo()
R version 4.2.0 alpha (2022-03-28 r82012)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.1 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8        LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
 [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C           LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

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

other attached packages:
 [1] RSelenium_1.7.9 forcats_0.5.2   stringr_1.5.0   dplyr_1.0.10    purrr_1.0.0     readr_2.1.3     tidyr_1.2.1     tibble_3.1.8   
 [9] ggplot2_3.4.0   tidyverse_1.3.2

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.9          lubridate_1.9.0     binman_0.1.3        ps_1.7.2            assertthat_0.2.1    utf8_1.2.2          R6_2.5.1           
 [8] cellranger_1.1.0    backports_1.4.1     reprex_2.0.2        httr_1.4.4          pillar_1.8.1        rlang_1.0.6         curl_4.3.3         
[15] googlesheets4_1.0.1 readxl_1.4.1        rstudioapi_0.14     googledrive_2.0.0   wdman_0.2.6         munsell_0.5.0       broom_1.0.2        
[22] compiler_4.2.0      modelr_0.1.10       pkgconfig_2.0.3     tidyselect_1.2.0    fansi_1.0.3         crayon_1.5.2        withr_2.5.0        
[29] tzdb_0.3.0          dbplyr_2.2.1        rappdirs_0.3.3      bitops_1.0-7        grid_4.2.0          jsonlite_1.8.4      gtable_0.3.1       
[36] lifecycle_1.0.3     DBI_1.1.3           magrittr_2.0.3      semver_0.2.0        scales_1.2.1        cli_3.5.0           stringi_1.7.8      
[43] fs_1.5.2            xml2_1.3.3          ellipsis_0.3.2      generics_0.1.3      vctrs_0.5.1         tools_4.2.0         glue_1.6.2         
[50] hms_1.1.2           yaml_2.3.6          processx_3.8.0      timechange_0.1.1    colorspace_2.0-3    gargle_1.2.1        caTools_1.18.2     
[57] rvest_1.0.3         haven_2.5.1    

I have RSelenium working on my personal laptop and I have checked that the packages are the same/up-to-date.

2

Answers


  1. I’m suffering from exactly the same issue with a code that was once working. I’m running in Ubuntu 22.10 in R 4.2.2 and RSelenium 1.7.9. The line of code I run is :

      rD <- RSelenium::rsDriver(browser = "firefox", port = 3040L, verbose = T, check = F,
                                extraCapabilities = list("moz:firefoxOptions" = list(
                                  args = list('--headless')
                                )))
    

    And I get the following error message :

    [1] "Connecting to remote server"
    Could not open firefox browser.
    Client error message:
    Undefined error in httr call. httr output: Failed to connect to localhost port 3040 after 0 ms: Connection refused
    Check server log for further details.
    Warning message:
    In RSelenium::rsDriver(browser = "firefox", port = 3040L, verbose = T, :
    Could not determine server status.

    Login or Signup to reply.
  2. Try setting chromever to NULL. Even though you are using Firefox, there is an issue arising from how selenium checks the chrome version upon initialization.

    rD <- RSelenium::rsDriver(
       port = 4454L,
       browser = c("firefox"),
       version = "latest",
       chromever = NULL
    )
    

    More information here:
    https://github.com/ropensci/wdman/issues/31

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search