webdriver-installer 1.1.6 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/chrome.js +110 -6
- package/edge.js +17 -4
- package/firefox.js +5 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.1.8](https://github.com/shaka-project/webdriver-installer/compare/v1.1.7...v1.1.8) (2023-08-18)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* Get the correct binary for Firefox on M1 macs ([#31](https://github.com/shaka-project/webdriver-installer/issues/31)) ([f0e5a7c](https://github.com/shaka-project/webdriver-installer/commit/f0e5a7cc8d7ccc8f367bcf9386c383645e16eb3d))
|
|
9
|
+
* Work around failure to launch Edge on Linux ([#32](https://github.com/shaka-project/webdriver-installer/issues/32)) ([ce45a24](https://github.com/shaka-project/webdriver-installer/commit/ce45a243e2d4e63ef32992607a1228d2b079d960))
|
|
10
|
+
|
|
11
|
+
## [1.1.7](https://github.com/shaka-project/webdriver-installer/compare/v1.1.6...v1.1.7) (2023-08-17)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* Fix Chromedriver download for version 115+ ([#28](https://github.com/shaka-project/webdriver-installer/issues/28)) ([1d17e40](https://github.com/shaka-project/webdriver-installer/commit/1d17e40c70be980067f4972d538ddb55db88c759))
|
|
17
|
+
* Get the correct binary for Edge on M1 macs ([#30](https://github.com/shaka-project/webdriver-installer/issues/30)) ([b5303ea](https://github.com/shaka-project/webdriver-installer/commit/b5303ea26653cee24a122208a1e7088021a77ebe))
|
|
18
|
+
|
|
3
19
|
## [1.1.6](https://github.com/shaka-project/webdriver-installer/compare/v1.1.5...v1.1.6) (2023-07-19)
|
|
4
20
|
|
|
5
21
|
|
package/chrome.js
CHANGED
|
@@ -11,6 +11,9 @@ const os = require('os');
|
|
|
11
11
|
const path = require('path');
|
|
12
12
|
|
|
13
13
|
const CDN_URL = 'https://chromedriver.storage.googleapis.com';
|
|
14
|
+
const VERSION_DATA_URL = 'https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone-with-downloads.json';
|
|
15
|
+
// Chrome distribution changed in version 115.
|
|
16
|
+
const NEW_CHROME_DISTRIBUTION_VERSION = 115;
|
|
14
17
|
|
|
15
18
|
/**
|
|
16
19
|
* An installer for chromedriver for desktop Chrome.
|
|
@@ -64,25 +67,59 @@ class ChromeWebDriverInstaller extends WebDriverInstallerBase {
|
|
|
64
67
|
*/
|
|
65
68
|
async getBestDriverVersion(browserVersion) {
|
|
66
69
|
const idealMajorVersion = parseInt(browserVersion.split('.')[0], 10);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
|
|
71
|
+
if (idealMajorVersion < NEW_CHROME_DISTRIBUTION_VERSION) {
|
|
72
|
+
return await InstallerUtils.fetchVersionUrl(
|
|
73
|
+
`${CDN_URL}/LATEST_RELEASE_${idealMajorVersion}`);
|
|
74
|
+
} else {
|
|
75
|
+
const data = await this.getVersionData_();
|
|
76
|
+
|
|
77
|
+
// Fall back on the major version if necessary.
|
|
78
|
+
// We haven't seen this become necessary yet since the new distribution
|
|
79
|
+
// mechanism debuted, but better safe than sorry.
|
|
80
|
+
let majorVersion = idealMajorVersion;
|
|
81
|
+
while (majorVersion >= NEW_CHROME_DISTRIBUTION_VERSION) {
|
|
82
|
+
if (majorVersion in data['milestones']) {
|
|
83
|
+
return data['milestones'][majorVersion]['version'];
|
|
84
|
+
}
|
|
85
|
+
majorVersion -= 1;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
throw new Error(`Unable to locate chromedriver ${idealMajorVersion}!`);
|
|
89
|
+
}
|
|
71
90
|
}
|
|
72
91
|
|
|
73
92
|
/**
|
|
74
93
|
* @param {string} driverVersion
|
|
75
94
|
* @param {string} outputDirectory
|
|
76
|
-
* @param {string=} outputName
|
|
77
95
|
* @return {!Promise}
|
|
78
96
|
*/
|
|
79
97
|
async install(driverVersion, outputDirectory) {
|
|
98
|
+
const majorVersion = parseInt(driverVersion.split('.')[0], 10);
|
|
99
|
+
|
|
100
|
+
if (majorVersion < NEW_CHROME_DISTRIBUTION_VERSION) {
|
|
101
|
+
await this.installOld_(driverVersion, outputDirectory);
|
|
102
|
+
} else {
|
|
103
|
+
await this.installNew_(majorVersion, driverVersion, outputDirectory);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @param {string} driverVersion
|
|
109
|
+
* @param {string} outputDirectory
|
|
110
|
+
* @return {!Promise}
|
|
111
|
+
*/
|
|
112
|
+
async installOld_(driverVersion, outputDirectory) {
|
|
80
113
|
let platform;
|
|
81
114
|
|
|
82
115
|
if (os.platform() == 'linux') {
|
|
83
116
|
platform = 'linux64';
|
|
84
117
|
} else if (os.platform() == 'darwin') {
|
|
85
|
-
|
|
118
|
+
if (process.arch == 'arm64') {
|
|
119
|
+
platform = 'mac_arm64';
|
|
120
|
+
} else {
|
|
121
|
+
platform = 'mac64';
|
|
122
|
+
}
|
|
86
123
|
} else if (os.platform() == 'win32') {
|
|
87
124
|
platform = 'win32';
|
|
88
125
|
} else {
|
|
@@ -106,6 +143,73 @@ class ChromeWebDriverInstaller extends WebDriverInstallerBase {
|
|
|
106
143
|
archiveUrl, binaryName, outputName,
|
|
107
144
|
outputDirectory, /* isZip= */ true);
|
|
108
145
|
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @param {number} majorVersion
|
|
149
|
+
* @param {string} driverVersion
|
|
150
|
+
* @param {string} outputDirectory
|
|
151
|
+
* @return {!Promise}
|
|
152
|
+
*/
|
|
153
|
+
async installNew_(majorVersion, driverVersion, outputDirectory) {
|
|
154
|
+
let platform;
|
|
155
|
+
|
|
156
|
+
if (os.platform() == 'linux') {
|
|
157
|
+
platform = 'linux64';
|
|
158
|
+
} else if (os.platform() == 'darwin') {
|
|
159
|
+
if (process.arch == 'arm64') {
|
|
160
|
+
platform = 'mac-arm64';
|
|
161
|
+
} else {
|
|
162
|
+
platform = 'mac-x64';
|
|
163
|
+
}
|
|
164
|
+
} else if (os.platform() == 'win32') {
|
|
165
|
+
platform = 'win64';
|
|
166
|
+
} else {
|
|
167
|
+
throw new Error(`Unrecognized platform: ${os.platform()}`);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
let binaryName = `chromedriver-${platform}/chromedriver`;
|
|
171
|
+
if (os.platform() == 'win32') {
|
|
172
|
+
binaryName += '.exe';
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
let outputName = this.getDriverName();
|
|
176
|
+
if (os.platform() == 'win32') {
|
|
177
|
+
outputName += '.exe';
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const data = await this.getVersionData_();
|
|
181
|
+
const downloads = data['milestones'][majorVersion]['downloads']['chromedriver'];
|
|
182
|
+
|
|
183
|
+
let archiveUrl;
|
|
184
|
+
for (const download of downloads) {
|
|
185
|
+
if (download['platform'] == platform) {
|
|
186
|
+
archiveUrl = download['url'];
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (!archiveUrl) {
|
|
192
|
+
throw new Error(
|
|
193
|
+
`Unable to locate chromedriver ${majorVersion} for ${platform}!`);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return await InstallerUtils.installBinary(
|
|
197
|
+
archiveUrl, binaryName, outputName,
|
|
198
|
+
outputDirectory, /* isZip= */ true);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @return {!Object}
|
|
203
|
+
* @private
|
|
204
|
+
*/
|
|
205
|
+
async getVersionData_() {
|
|
206
|
+
if (!this.versionDataCache_) {
|
|
207
|
+
const response = await InstallerUtils.fetchUrl(VERSION_DATA_URL);
|
|
208
|
+
this.versionDataCache_ = await response.json();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return this.versionDataCache_;
|
|
212
|
+
}
|
|
109
213
|
}
|
|
110
214
|
|
|
111
215
|
module.exports = {ChromeWebDriverInstaller};
|
package/edge.js
CHANGED
|
@@ -63,8 +63,6 @@ class EdgeWebDriverInstaller extends WebDriverInstallerBase {
|
|
|
63
63
|
* @return {!Promise<string>}
|
|
64
64
|
*/
|
|
65
65
|
async getBestDriverVersion(browserVersion) {
|
|
66
|
-
const idealMajorVersion = parseInt(browserVersion.split('.')[0], 10);
|
|
67
|
-
|
|
68
66
|
let platform;
|
|
69
67
|
if (os.platform() == 'linux') {
|
|
70
68
|
platform = 'LINUX';
|
|
@@ -80,6 +78,18 @@ class EdgeWebDriverInstaller extends WebDriverInstallerBase {
|
|
|
80
78
|
return `${CDN_URL}/LATEST_RELEASE_${majorVersion}_${platform}`;
|
|
81
79
|
};
|
|
82
80
|
|
|
81
|
+
let idealMajorVersion = parseInt(browserVersion.split('.')[0], 10);
|
|
82
|
+
|
|
83
|
+
// Work around https://github.com/MicrosoftEdge/EdgeWebDriver/issues/102,
|
|
84
|
+
// in which Linux versions of msedgedriver launch Chrome instead of Edge
|
|
85
|
+
// starting with version 115. For now, driver version 114 is working for
|
|
86
|
+
// Edge 115 on Linux.
|
|
87
|
+
if (os.platform() == 'linux') {
|
|
88
|
+
if (idealMajorVersion > 114) {
|
|
89
|
+
idealMajorVersion = 114;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
83
93
|
return await InstallerUtils.fetchVersionUrlWithAutomaticDowngrade(
|
|
84
94
|
idealMajorVersion,
|
|
85
95
|
/* minMajorVersion */ idealMajorVersion - 2,
|
|
@@ -90,7 +100,6 @@ class EdgeWebDriverInstaller extends WebDriverInstallerBase {
|
|
|
90
100
|
/**
|
|
91
101
|
* @param {string} driverVersion
|
|
92
102
|
* @param {string} outputDirectory
|
|
93
|
-
* @param {string=} outputName
|
|
94
103
|
* @return {!Promise}
|
|
95
104
|
*/
|
|
96
105
|
async install(driverVersion, outputDirectory) {
|
|
@@ -99,7 +108,11 @@ class EdgeWebDriverInstaller extends WebDriverInstallerBase {
|
|
|
99
108
|
if (os.platform() == 'linux') {
|
|
100
109
|
platform = 'linux64';
|
|
101
110
|
} else if (os.platform() == 'darwin') {
|
|
102
|
-
|
|
111
|
+
if (process.arch == 'arm64') {
|
|
112
|
+
platform = 'mac64_m1';
|
|
113
|
+
} else {
|
|
114
|
+
platform = 'mac64';
|
|
115
|
+
}
|
|
103
116
|
} else if (os.platform() == 'win32') {
|
|
104
117
|
platform = 'win64';
|
|
105
118
|
} else {
|
package/firefox.js
CHANGED
|
@@ -74,7 +74,6 @@ class FirefoxWebDriverInstaller extends WebDriverInstallerBase {
|
|
|
74
74
|
/**
|
|
75
75
|
* @param {string} driverVersion
|
|
76
76
|
* @param {string} outputDirectory
|
|
77
|
-
* @param {string=} outputName
|
|
78
77
|
* @return {!Promise}
|
|
79
78
|
*/
|
|
80
79
|
async install(driverVersion, outputDirectory) {
|
|
@@ -87,7 +86,11 @@ class FirefoxWebDriverInstaller extends WebDriverInstallerBase {
|
|
|
87
86
|
extension = 'tar.gz';
|
|
88
87
|
isZip = false;
|
|
89
88
|
} else if (os.platform() == 'darwin') {
|
|
90
|
-
|
|
89
|
+
if (process.arch == 'arm64') {
|
|
90
|
+
platform = 'macos-aarch64';
|
|
91
|
+
} else {
|
|
92
|
+
platform = 'macos';
|
|
93
|
+
}
|
|
91
94
|
extension = 'tar.gz';
|
|
92
95
|
isZip = false;
|
|
93
96
|
} else if (os.platform() == 'win32') {
|