chromedriver 97.0.0 → 97.0.4
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/README.md +22 -0
- package/install.js +43 -8
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -267,6 +267,28 @@ DETECT_CHROMEDRIVER_VERSION=true npm install chromedriver
|
|
|
267
267
|
**Note:** When the property `detect_chromedriver_version` is provided,
|
|
268
268
|
`chromedriver_version` and `chromedriver_filepath` properties are ignored.
|
|
269
269
|
|
|
270
|
+
## Include Chromium
|
|
271
|
+
|
|
272
|
+
If you don't have Chrome installed, you can check for Chromium version instead by setting the argument `include_chromium` to `true`.
|
|
273
|
+
|
|
274
|
+
```shell
|
|
275
|
+
npm install chromedriver --include_chromium
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Or add property into your [`.npmrc`](https://docs.npmjs.com/files/npmrc) file.
|
|
279
|
+
|
|
280
|
+
```
|
|
281
|
+
include_chromium=true
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Another option is to use environment variable `INCLUDE_CHROMIUM`.
|
|
285
|
+
|
|
286
|
+
```shell
|
|
287
|
+
INCLUDE_CHROMIUM=true npm install chromedriver
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
**Note:** The property `INCLUDE_CHROMIUM` is ignored if the property `DETECT_CHROMEDRIVER_VERSION` is not used.
|
|
291
|
+
|
|
270
292
|
## A Note on chromedriver
|
|
271
293
|
|
|
272
294
|
Chromedriver is not a library for NodeJS.
|
package/install.js
CHANGED
|
@@ -10,11 +10,15 @@ const child_process = require('child_process');
|
|
|
10
10
|
const os = require('os');
|
|
11
11
|
const url = require('url');
|
|
12
12
|
const https = require('https');
|
|
13
|
+
const { promisify } = require('util');
|
|
14
|
+
const { finished } = require('stream');
|
|
13
15
|
const extractZip = require('extract-zip');
|
|
14
16
|
const { getChromeVersion } = require('@testim/chrome-version');
|
|
15
17
|
const HttpsProxyAgent = require('https-proxy-agent');
|
|
16
18
|
const getProxyForUrl = require("proxy-from-env").getProxyForUrl;
|
|
17
19
|
|
|
20
|
+
const finishedAsync = promisify(finished);
|
|
21
|
+
|
|
18
22
|
const skipDownload = process.env.npm_config_chromedriver_skip_download || process.env.CHROMEDRIVER_SKIP_DOWNLOAD;
|
|
19
23
|
if (skipDownload === 'true') {
|
|
20
24
|
console.log('Found CHROMEDRIVER_SKIP_DOWNLOAD variable, skipping installation.');
|
|
@@ -29,6 +33,7 @@ const configuredfilePath = process.env.npm_config_chromedriver_filepath || proce
|
|
|
29
33
|
cdnUrl = cdnUrl.replace(/\/+$/, '');
|
|
30
34
|
const platform = validatePlatform();
|
|
31
35
|
const detect_chromedriver_version = process.env.npm_config_detect_chromedriver_version || process.env.DETECT_CHROMEDRIVER_VERSION;
|
|
36
|
+
const include_chromium = (process.env.npm_config_include_chromium || process.env.INCLUDE_CHROMIUM) === 'true';
|
|
32
37
|
let chromedriver_version = process.env.npm_config_chromedriver_version || process.env.CHROMEDRIVER_VERSION || helper.version;
|
|
33
38
|
let chromedriverBinaryFilePath;
|
|
34
39
|
let downloadedFile = '';
|
|
@@ -37,7 +42,7 @@ let downloadedFile = '';
|
|
|
37
42
|
try {
|
|
38
43
|
if (detect_chromedriver_version === 'true') {
|
|
39
44
|
// Refer http://chromedriver.chromium.org/downloads/version-selection
|
|
40
|
-
const chromeVersion = await getChromeVersion();
|
|
45
|
+
const chromeVersion = await getChromeVersion(include_chromium);
|
|
41
46
|
console.log("Your Chrome version is " + chromeVersion);
|
|
42
47
|
const chromeVersionWithoutPatch = /^(.*?)\.\d+$/.exec(chromeVersion)[1];
|
|
43
48
|
await getChromeDriverVersion(getRequestOptions(cdnUrl + '/LATEST_RELEASE_' + chromeVersionWithoutPatch));
|
|
@@ -81,16 +86,19 @@ function validatePlatform() {
|
|
|
81
86
|
process.exit(1);
|
|
82
87
|
}
|
|
83
88
|
} else if (thePlatform === 'darwin' || thePlatform === 'freebsd') {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
89
|
+
const osxPlatform = getMacOsRealArch();
|
|
90
|
+
|
|
91
|
+
if (!osxPlatform) {
|
|
87
92
|
console.log('Only Mac 64 bits supported.');
|
|
88
93
|
process.exit(1);
|
|
89
94
|
}
|
|
95
|
+
|
|
96
|
+
thePlatform = osxPlatform;
|
|
90
97
|
} else if (thePlatform !== 'win32') {
|
|
91
98
|
console.log('Unexpected platform or architecture:', process.platform, process.arch);
|
|
92
99
|
process.exit(1);
|
|
93
100
|
}
|
|
101
|
+
|
|
94
102
|
return thePlatform;
|
|
95
103
|
}
|
|
96
104
|
|
|
@@ -256,10 +264,11 @@ async function requestBinary(requestOptions, filePath) {
|
|
|
256
264
|
console.error('Error status code:', error.response.status);
|
|
257
265
|
if (error.response.data) {
|
|
258
266
|
error.response.data.on('data', data => console.error(data.toString('utf8')));
|
|
259
|
-
|
|
260
|
-
error.response.data
|
|
261
|
-
|
|
262
|
-
|
|
267
|
+
try {
|
|
268
|
+
await finishedAsync(error.response.data)
|
|
269
|
+
} catch (error) {
|
|
270
|
+
console.error('Error downloading entire response:', error);
|
|
271
|
+
}
|
|
263
272
|
}
|
|
264
273
|
}
|
|
265
274
|
throw new Error('Error with http(s) request: ' + error);
|
|
@@ -330,6 +339,32 @@ function fixFilePermissions() {
|
|
|
330
339
|
}
|
|
331
340
|
}
|
|
332
341
|
|
|
342
|
+
function getMacOsRealArch() {
|
|
343
|
+
if (process.arch === 'arm64' || isEmulatedRosettaEnvironment()) {
|
|
344
|
+
return 'mac64_m1';
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (process.arch === 'x64') {
|
|
348
|
+
return 'mac64';
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
return null;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
function isEmulatedRosettaEnvironment() {
|
|
355
|
+
const archName = child_process.spawnSync('uname', ['-m']).stdout.toString().trim();
|
|
356
|
+
|
|
357
|
+
if (archName === 'x86_64') {
|
|
358
|
+
const processTranslated = child_process.spawnSync('sysctl', ['-in', 'sysctl.proc_translated'])
|
|
359
|
+
.stdout.toString()
|
|
360
|
+
.trim();
|
|
361
|
+
|
|
362
|
+
return processTranslated === '1';
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
return false;
|
|
366
|
+
}
|
|
367
|
+
|
|
333
368
|
function Deferred() {
|
|
334
369
|
this.resolve = null;
|
|
335
370
|
this.reject = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chromedriver",
|
|
3
|
-
"version": "97.0.
|
|
3
|
+
"version": "97.0.4",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"chromedriver",
|
|
6
6
|
"selenium"
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"update-chromedriver": "node update.js"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@testim/chrome-version": "^1.
|
|
30
|
-
"axios": "^0.
|
|
29
|
+
"@testim/chrome-version": "^1.1.2",
|
|
30
|
+
"axios": "^0.24.0",
|
|
31
31
|
"del": "^6.0.0",
|
|
32
32
|
"extract-zip": "^2.0.1",
|
|
33
33
|
"https-proxy-agent": "^5.0.0",
|