Skip to content

Commit

Permalink
fix: Work around failure to launch Edge on Linux (#32)
Browse files Browse the repository at this point in the history
Work around MicrosoftEdge/EdgeWebDriver#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.
  • Loading branch information
joeyparrish committed Aug 18, 2023
1 parent f0e5a7c commit ce45a24
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions edge.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ class EdgeWebDriverInstaller extends WebDriverInstallerBase {
* @return {!Promise<string>}
*/
async getBestDriverVersion(browserVersion) {
const idealMajorVersion = parseInt(browserVersion.split('.')[0], 10);

let platform;
if (os.platform() == 'linux') {
platform = 'LINUX';
Expand All @@ -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,
Expand Down

0 comments on commit ce45a24

Please sign in to comment.