+4 votes
1 view
in Devops and Agile by (17.7k points)

I'm trying to run RSelenium using the rsDriver function, but when I run  rD <- rsDriver() I get a message telling me I need a newer version of Chrome:

> rD <- rsDriver()

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"

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/[email protected]{#29}),platform=Mac OS X 10.14.3 x86_64)

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.

The error message appears to say that I need Chrome version 74.0.3729.6, but when I look in Chrome's settings, it tells me that I'm running the latest stable version (73.0.3683.75). Upon further googling, 74.0.3729.6 is a pre-release dev version of Chrome: do I need to install this in order to use ChromeDriver with RSelenium?

I'm not wedded to the idea of using Chrome, but I haven't been able to get rsDriver to use Firefox: when I specify browser = "firefox", rsDriver gives me the same error message about ChromeDriver not supporting my version of Chrome.

My session info is:

R version 3.5.2 (2018-12-20)

Platform: x86_64-apple-darwin15.6.0 (64-bit)

Running under: macOS Mojave 10.14.3

Matrix products: default

BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib

LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:

[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:

[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:

 [1] wdman_0.2.4     forcats_0.3.0   stringr_1.3.1   dplyr_0.7.8     purrr_0.2.5     readr_1.3.1     tidyr_0.8.2    

 [8] tibble_2.0.1    ggplot2_3.1.0   tidyverse_1.2.1 rvest_0.3.2     xml2_1.2.0      RSelenium_1.7.5

4 Answers

+2 votes
by (48.1k points)
selected by
 
Best answer

I just ran into the same kind of error using RSelenium::rsDriver()'s default chromever = "latest" set which resulted in the failed attempt to combine chromedriver 75.0.3770.8 with latest google-chrome-stable 74.0.3729.157:

session not created: This version of ChromeDriver only supports Chrome version 75

Since this obviously seems to be a recurring and pretty annoying issue, I have come up with the following workaround to always use the latest compatible ChromeDriver version:

 rD <- RSelenium::rsDriver(browser = "chrome",

                          chromever =

                                  system2(command = "google-chrome-stable",

                                          args = "--version",

                                          stdout = TRUE,

                                          stderr = TRUE) %>%

                                  stringr::str_extract(pattern = "(?<=Chrome )\\d+\\.\\d+\\.\\d+\\.") %>%

                                  magrittr::extract(!is.na(.)) %>%

                                  stringr::str_replace_all(pattern = "\\.",

                                                           replacement = "\\\\.") %>%

                                  paste0("^",  .) %>%

                                  stringr::str_subset(string =

                                                              binman::list_versions(appname = "chromedriver") %>%

                                                              dplyr::last()) %>%

                                  as.numeric_version() %>%

                                  max() %>%

                                  as.character())

The above code is only tested under Linux and makes use of some tidyverse packages (install them beforehand or rewrite it in base R). For other operating systems you might have to adapt it a bit, particularly replace command = "google-chrome-stable" with the system-specific command to launch Google Chrome:

 

On macOS it should be enough to replace

command = "google-chrome-stable" with command = "/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome" (untested)

 

On Windows, a platform-specific bug prevents us from calling the Google Chrome binary directly to get its version number. Instead, do the following:

 rD <- RSelenium::rsDriver(browser = "chrome",

                          chromever =

                            system2(command = "wmic",

                                    args = 'datafile where name="C:\\\\Program Files (x86)\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe" get Version /value',

                                    stdout = TRUE,

                                    stderr = TRUE) %>%

                            stringr::str_extract(pattern = "(?<=Version=)\\d+\\.\\d+\\.\\d+\\.") %>%

                            magrittr::extract(!is.na(.)) %>%

                            stringr::str_replace_all(pattern = "\\.", replacement = "\\\\.") %>%

                            paste0("^",  .) %>%

                            stringr::str_subset(string = binman::list_versions(appname = "chromedriver") %>%

                                                  dplyr::last()) %>%

                            as.numeric_version() %>%

                            max() %>%

                            as.character())

Basically, the code just ensures the latest ChromeDriver version matching the major-minor-patch version number of the system's stable Google Chrome browser is passed as a chromever argument. This procedure should adhere to the official ChromeDriver versioning scheme. Quote:

 

ChromeDriver uses the same version number scheme as Chrome (...)

Each version of ChromeDriver supports Chrome with matching major, minor and build version numbers. For example, ChromeDriver 73.0.3683.20 supports all Chrome versions that start with 73.0.3683.

by (17.7k points)
Thanks, very well explained it worked for me!
by (32.8k points)
This answer is helpful.
Thanks!
by (36.7k points)
In my case, I was able to use the following code to establish a connection.

driver <- rsDriver(browser=c("chrome"), chromever="73.0.3683.68", extraCapabilities = eCaps)

You should be able to specify your version of Chrome with the chromever= argument. I had to use the closest version, though (my chrome version was "73.0.3683.75").
+3 votes
by (44.6k points)

This error message...

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/[email protected]{#29}),platform=Mac OS X 10.14.3 x86_64)

...implies that the ChromeDriver expects the Chrome Browser version to be 74.

Your main problem is the incompatibility between the version of the binaries you are using as follows:

You are applying chromedriver=74.0.3729.6

Release Notes of chromedriver=74.0.3729.6 mentions the following :

Supports Chrome v74

You are working with the currently released chrome=73.0

Thus there is a clear mismatch between the ChromeDriver v74.0.3729.6 and the Chrome Browser v73.0

The Solution is: 

  • Minimize ChromeDriver to ChromeDriver v73.0.3683.68 level.
  • Have Chrome version at the Chrome v73 level. (as per ChromeDriver v73.0.3683.68 release notes)
  • Refine your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • If your base Web Client version is too old, then uninstall it and install an up-to-date GA and released version of Web Client.
  • Execute your @Test.
  • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
by (7.4k points)
This worked for me. Thanks.
by (28.6k points)
Great answer! Very well explained!
by (27.7k points)
thanks for the detailed explanation!
+3 votes
by (42k points)

For tl:dr people, a short answer which worked for me:

  • Click on the icon in the upper right corner that looks like 3 short bars (drop-down).
  • Select Help >> About Google Chrome to display the version number and also automatically update to the newest version.

This cleared my error.

by (23.6k points)
Thanks this worked for me.
by (36.7k points)
Thanks for specifying the steps.
0 votes
by (67.1k points)

To get rid of this error you do not need to downgrade Chrome anymore, when you get this error you just have to run webdriver-manager update again.

...