From ce45a243e2d4e63ef32992607a1228d2b079d960 Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Fri, 18 Aug 2023 11:36:25 -0700 Subject: [PATCH] fix: Work around failure to launch Edge on Linux (#32) Work around https://github.com/MicrosoftEdge/EdgeWebDriver/issues/102, in which Linux versions of msedgedriver launch Chrome instead of Edge starting with version 115. For now, driver version 114 is working for Edge 115 on Linux. This does not appear to affect other platforms. --- edge.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/edge.js b/edge.js index c175704..0f485a1 100644 --- a/edge.js +++ b/edge.js @@ -63,8 +63,6 @@ class EdgeWebDriverInstaller extends WebDriverInstallerBase { * @return {!Promise} */ async getBestDriverVersion(browserVersion) { - const idealMajorVersion = parseInt(browserVersion.split('.')[0], 10); - let platform; if (os.platform() == 'linux') { platform = 'LINUX'; @@ -80,6 +78,18 @@ class EdgeWebDriverInstaller extends WebDriverInstallerBase { return `${CDN_URL}/LATEST_RELEASE_${majorVersion}_${platform}`; }; + let idealMajorVersion = parseInt(browserVersion.split('.')[0], 10); + + // Work around https://github.com/MicrosoftEdge/EdgeWebDriver/issues/102, + // in which Linux versions of msedgedriver launch Chrome instead of Edge + // starting with version 115. For now, driver version 114 is working for + // Edge 115 on Linux. + if (os.platform() == 'linux') { + if (idealMajorVersion > 114) { + idealMajorVersion = 114; + } + } + return await InstallerUtils.fetchVersionUrlWithAutomaticDowngrade( idealMajorVersion, /* minMajorVersion */ idealMajorVersion - 2,