From e9ec6f77963fff835fb533fab455d16429f54168 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Sat, 17 Feb 2024 07:45:39 +0100 Subject: [PATCH] Adjust for changed URL for chromedriver binaries --- .../commons/selenium/ChromeDriverUtils.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/dstadler/commons/selenium/ChromeDriverUtils.java b/src/main/java/org/dstadler/commons/selenium/ChromeDriverUtils.java index 5427b64f..a382daf9 100644 --- a/src/main/java/org/dstadler/commons/selenium/ChromeDriverUtils.java +++ b/src/main/java/org/dstadler/commons/selenium/ChromeDriverUtils.java @@ -92,14 +92,17 @@ public static void configureMatchingChromeDriver(String chromeVersion) throws IO String versionJson = IOUtils.toString(new URL(VERSION_JSON), StandardCharsets.UTF_8); // match the latest build with that version - // "https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/linux64/chromedriver-linux64.zip" + // https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/115.0.5790.170/linux64/chromedriver-linux64.zip + // https://storage.googleapis.com/chrome-for-testing-public/121.0.6167.0/linux64/chromedriver-linux64.zip Matcher matcher = Pattern. - compile( "https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/(" + chromeVersion + "[0-9.]+)/linux64/chromedriver-linux64.zip"). + compile( "https://(edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing|storage.googleapis.com/chrome-for-testing-public)/(" + chromeVersion + "[0-9.]+)/linux64/chromedriver-linux64.zip"). matcher(versionJson); // iterate over all matches to use the latest versions + String url = null; while (matcher.find()) { - driverVersion = matcher.group(1); + driverVersion = matcher.group(2); + url = matcher.group(1); } if (driverVersion == null) { @@ -109,9 +112,10 @@ public static void configureMatchingChromeDriver(String chromeVersion) throws IO checkState(StringUtils.isNotBlank(driverVersion), "Did not find a chrome-driver-version for " + chromeVersion + " at " + versionUrl); - downloadUrl = SystemUtils.IS_OS_WINDOWS ? - "https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/" + driverVersion + "/win64/chromedriver-win64.zip" : - "https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/" + driverVersion + "/linux64/chromedriver-linux64.zip"; + downloadUrl = "https://" + url + "/" + driverVersion + + (SystemUtils.IS_OS_WINDOWS ? + "/win64/chromedriver-win64.zip" : + "/linux64/chromedriver-linux64.zip"); } } catch (IOException e) { throw new IOException("Failed for " + versionUrl, e);