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

Chromedriver not updated #34

Open
dmurdoch opened this issue Aug 22, 2023 · 6 comments
Open

Chromedriver not updated #34

dmurdoch opened this issue Aug 22, 2023 · 6 comments

Comments

@dmurdoch
Copy link

dmurdoch commented Aug 22, 2023

Google Chrome has just updated to version 116.x.y.z, and there's no chromedriver available for that version. The website https://chromedriver.chromium.org/downloads refers to https://googlechromelabs.github.io/chrome-for-testing/, which the driver to be installed in a different way.

Will this be supported by RSelenium?

@dmurdoch dmurdoch changed the title "Chrome for testing" not supported Chromedriver not updated Aug 22, 2023
@oobd
Copy link

oobd commented Aug 23, 2023

Not sure if this will help but for windows, i downloaded latest chromedriver from the link you had which had the link below

https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/116.0.5845.96/win32/chromedriver-win32.zip

then i created a folder called
116.0.5845.96 in
C:\Users\USERNAME\AppData\Local\binman\binman_chromedriver\win32

and extracted the contents from .zip file into the new 116.0.5845.96 folder

and specified version of chromedriver to use in

specify version

pJS <- wdman::chrome(port = port, version = '116.0.5845.96')

and it works now.. not a great solution since wdman doesn’t seem to have 116 drivers automatically but works if you are in a pinch and need things to get things working

@dmurdoch
Copy link
Author

A similar workaround worked for me on an Intel Mac. I unzipped the downloaded driver in ~/Library/Application Support/binman_chromedriver/mac64/116.0.5845.96. Running binman::list_versions("chromedriver") saw it there, so loading happened in my script (which looks through the list, it doesn't use "latest").

@dmurdoch
Copy link
Author

This is a first attempt at an update of the code. I added a new function to wdman based on the binman::predl_google_storage function:

#' Pre-download function for Chrome-for-testing site
#'
#' @param url URL of the JSON to use for files
#' @param platform One of `c("linux64", "mac-arm64", "mac-x64",
#'                           "win32", "win64")
#' @param history Integer number of recent entries
#' @param appname Name of the app, typically `"chromedriver"`
#'
#' @return A named list of dataframes.  The name indicates the platform.  The dataframe should contain the version, url, and file to
#' be processed.  Used as input for `binman::download_files()` or an equivalent.
#' @export
predl_chrome_for_testing <- function(url, platform, history,
                                     appname) {
  assert_that(is_URL_file(url))
  assert_that(is_character(platform))
  assert_that(is_integer(history))
  assert_that(is_string(appname))
  ver_data <- jsonlite::fromJSON(url)[[2]]
  ver_data <- Filter(function(x) !is.null(x$downloads[[appname]]),
         ver_data)
  ver_data <- ver_data[order(as.numeric(names(ver_data)))]
  unwrap <- function(entry) {
    version <- entry$version
    downloads <- entry$downloads[[appname]]
    if (!is.null(downloads)) {
      platform <- downloads$platform
      url <- downloads$url
      file <- basename(url)
      data.frame(version, platform, url, file)
    }
  }
  extracted <- do.call(rbind, lapply(ver_data, unwrap))
  app_links <- tapply(extracted, extracted$platform, identity)
  assign_directory(setNames(app_links, platform), appname)
}

This is the change to chromedriver.yml to use this function:

name: chromedriver
predlfunction:
  "wdman::predl_chrome_for_testing":
    url: https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone-with-downloads.json
    platform:
    - mac_arm64
    - mac_x64
    - linux64
    - win32
    - win64
    history: 3
    appname: "chromedriver"
dlfunction:
  "binman::download_files": []
postdlfunction:
  "binman::unziptar_dlfiles":
    chmod: TRUE

There are still a number of issues to address:

  1. This ignores the old download method. The new site doesn't include old chromedriver versions, so I think both methods are needed.
  2. The platform names are the names from the download site. Should they be the names previously used by wdman instead?
  3. How to test it?

@dietrichson
Copy link

@dmurdoch I can test this on Mac (just got a new one), but it would be useful to have a branch to check out.
I have used the manual workarounds suggested which cover my immediate needs, but are rather inelegant (as in hard-coded).

@dmurdoch
Copy link
Author

@dietrichson: I just submitted my changes as a PR #35. They aren't ready to merge. Someone who knows wdman can probably spot errors, and the issues in my previous comment haven't been addressed.

@dietrichson
Copy link

@dmurdoch I tested this today, this is what I got:
`> library(wdman)

selServ <- selenium(verbose = TRUE)
checking Selenium Server versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking chromedriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
Creating directory: ~/Library/Application Supp...
Downloading binary: https://edgedl.me.gvt1.com...

Creating directory: ~/Library/Application Supp...
Downloading binary: https://edgedl.me.gvt1.com...

Creating directory: ~/Library/Application Supp...
Downloading binary: https://edgedl.me.gvt1.com...

Creating directory: ~/Library/Application Supp...
Downloading binary: https://edgedl.me.gvt1.com...

Creating directory: ~/Library/Application Supp...
Downloading binary: https://edgedl.me.gvt1.com...

BEGIN: POSTDOWNLOAD
Error in file.copy(list.files(dir, full.names = TRUE), dirname(dir)) :
more 'from' files than 'to' files`

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