Commit ac5bae53 authored by YuShijiaCode's avatar YuShijiaCode

driver

parent fa8da103
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2014 Giovanni Bassi and Elemar Jr.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
# ChromeDriver
[![Build status](https://travis-ci.org/giggio/node-chromedriver.svg)](https://travis-ci.org/giggio/node-chromedriver/) [![Build status](https://ci.appveyor.com/api/projects/status/wr4c16rs5q113vy3?svg=true)](https://ci.appveyor.com/project/giggio/node-chromedriver) [![Build Status](https://api.shippable.com/projects/5c01ad17718ee50700de68bc/badge?branch=master)](https://app.shippable.com/github/giggio/node-chromedriver/runs?branchName=master)
[![npm](https://img.shields.io/npm/dt/chromedriver.svg)](https://www.npmjs.com/package/chromedriver)
An NPM wrapper for Selenium [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/).
## Building and Installing
```shell
npm install chromedriver
```
Or grab the source and
```shell
node ./install.js
```
What this is really doing is just grabbing a particular "blessed" (by
this module) version of ChromeDriver. As new versions are released
and vetted, this module will be updated accordingly.
The package has been set up to fetch and run ChromeDriver for MacOS (darwin),
Linux based platforms (as identified by Node.js), and Windows. If you
spot any platform weirdness, let us know or send a patch.
## Force download
By default this package, when installed, will search for an existing
Chromedriver binary in your configured temp directory. If found, and it is the
correct version, it will simply copy it to your node_modules directory. You can
force it always download by configuring it:
```shell
npm install chromedriver --chromedriver-force-download
```
Or add property into your [`.npmrc`](https://docs.npmjs.com/files/npmrc) file.
```
chromedriver_force_download=true
```
Another option is to use PATH variable `CHROMEDRIVER_FORCE_DOWNLOAD`.
```shell
CHROMEDRIVER_FORCE_DOWNLOAD=true npm install chromedriver
```
## Custom binaries url
To use a mirror of the ChromeDriver binaries use npm config property `chromedriver_cdnurl`.
Default is `http://chromedriver.storage.googleapis.com`.
```shell
npm install chromedriver --chromedriver_cdnurl=https://npm.taobao.org/mirrors/chromedriver
```
Or add property into your [`.npmrc`](https://docs.npmjs.com/files/npmrc) file.
```
chromedriver_cdnurl=https://npm.taobao.org/mirrors/chromedriver
```
Another option is to use PATH variable `CHROMEDRIVER_CDNURL`.
```shell
CHROMEDRIVER_CDNURL=https://npm.taobao.org/mirrors/chromedriver npm install chromedriver
```
## Custom binaries file
To get the chromedriver from the filesystem instead of a web request use the npm config property `chromedriver_filepath`.
```shell
npm install chromedriver --chromedriver_filepath=/path/to/chromedriver_mac64.zip
```
Or add property into your [`.npmrc`](https://docs.npmjs.com/files/npmrc) file.
```
chromedriver_filepath=/path/to/chromedriver_mac64.zip
```
Another option is to use the PATH variable `CHROMEDRIVER_FILEPATH`
```shell
CHROMEDRIVER_FILEPATH=/path/to/chromedriver_mac64.zip
```
This variable can be used to set either a `.zip` file or the binary itself, eg:
```shell
CHROMEDRIVER_FILEPATH=/bin/chromedriver
```
## Custom download options
Install through a proxy.
```shell
npm config set proxy http://[user:pwd]@domain.tld:port
npm config set https-proxy http://[user:pwd]@domain.tld:port
```
Use different User-Agent.
```shell
npm config set user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
```
## Skipping chromedriver download
You may wish to skip the downloading of the chromedriver binary file, for example if you know for certain that it is already there or if you want to use a system binary and just use this module as an interface to interact with it.
To achieve this you can use the npm config property `chromedriver_skip_download`.
```shell
npm install chromedriver --chromedriver_skip_download=true
```
Or add property into your [`.npmrc`](https://docs.npmjs.com/files/npmrc) file.
```
chromedriver_skip_download=true
```
Another option is to use the PATH variable `CHROMEDRIVER_SKIP_DOWNLOAD`
```shell
CHROMEDRIVER_SKIP_DOWNLOAD=true
```
## Running
```shell
bin/chromedriver [arguments]
```
And npm will install a link to the binary in `node_modules/.bin` as
it is wont to do.
## Running with Selenium WebDriver
```javascript
require('chromedriver');
var webdriver = require('selenium-webdriver');
var driver = new webdriver.Builder()
.forBrowser('chrome')
.build();
```
(Tested for selenium-webdriver version `2.48.2`)
The path will be added to the process automatically, you don't need to configure it.
But you can get it from `require('chromedriver').path` if you want it.
## Running via node
The package exports a `path` string that contains the path to the
chromdriver binary/executable.
Below is an example of using this package via node.
```javascript
var childProcess = require('child_process');
var chromedriver = require('chromedriver');
var binPath = chromedriver.path;
var childArgs = [
'some argument'
];
childProcess.execFile(binPath, childArgs, function(err, stdout, stderr) {
// handle results
});
```
You can also use the start and stop methods:
```javascript
var chromedriver = require('chromedriver');
args = [
// optional arguments
];
chromedriver.start(args);
// run your tests
chromedriver.stop();
```
With the latest version, you can optionally receive a Promise from the `chromedriver.start` function:
```javascript
var returnPromise = true;
chromedriver
.start(args, returnPromise)
.then(() => {
console.log('chromedriver is ready');
});
```
Note: if your tests are ran asynchronously, chromedriver.stop() will have to be
executed as a callback at the end of your tests
## Versioning
The NPM package version tracks the version of chromedriver that will be installed,
with an additional build number that is used for revisions to the installer.
You can use the package version number to install a specific version, or use the
setting to a specific version. To always install the latest version of Chromedriver,
use `LATEST` as the version number:
```shell
npm install chromedriver --chromedriver_version=LATEST
```
Or add property into your [`.npmrc`](https://docs.npmjs.com/files/npmrc) file.
```
chromedriver_version=LATEST
```
Another option is to use env variable `CHROMEDRIVER_VERSION`.
```shell
CHROMEDRIVER_VERSION=LATEST npm install chromedriver
```
## A Note on chromedriver
Chromedriver is not a library for NodeJS.
This is an _NPM wrapper_ and can be used to conveniently make ChromeDriver available.
It is not a Node.js wrapper.
## Supported Node.js versions
We will do our best to support every supported Node.js versions.
See [nodejs/Release](https://github.com/nodejs/Release) for
the current supported versions. You can also view our build
scripts for
[Windows](https://github.com/giggio/node-chromedriver/blob/master/appveyor.yml)
and
[Linux and Mac](https://github.com/giggio/node-chromedriver/blob/master/.travis.yml).
## Contributing
Questions, comments, bug reports, and pull requests are all welcome. Submit them at
[the project on GitHub](https://github.com/giggio/node-chromedriver/).
Bug reports that include steps-to-reproduce (including code) are the
best. Even better, make them in the form of pull requests.
## Author
[Giovanni Bassi](https://github.com/giggio), with collaboration from
[lots of good people](https://github.com/giggio/node-chromedriver/graphs/contributors).
Thanks for Obvious and their PhantomJS project for heavy inspiration! Check their project on [Github](https://github.com/Obvious/phantomjs/tree/master/bin).
## License
Licensed under the Apache License, Version 2.0.
'use strict';
const extractZip = require('extract-zip');
const fs = require('fs');
const helper = require('./lib/chromedriver');
const request = require('request');
const mkdirp = require('mkdirp');
const path = require('path');
const del = require('del');
const child_process = require('child_process');
const os = require('os');
const skipDownload = process.env.npm_config_chromedriver_skip_download || process.env.CHROMEDRIVER_SKIP_DOWNLOAD;
if (skipDownload) {
console.log('Found CHROMEDRIVER_SKIP_DOWNLOAD variable, skipping installation.');
process.exit(0);
}
const libPath = path.join(__dirname, 'lib', 'chromedriver');
let cdnUrl = process.env.npm_config_chromedriver_cdnurl || process.env.CHROMEDRIVER_CDNURL || 'https://chromedriver.storage.googleapis.com';
const configuredfilePath = process.env.npm_config_chromedriver_filepath || process.env.CHROMEDRIVER_FILEPATH;
// adapt http://chromedriver.storage.googleapis.com/
cdnUrl = cdnUrl.replace(/\/+$/, '');
let platform = process.platform;
let chromedriver_version = process.env.npm_config_chromedriver_version || process.env.CHROMEDRIVER_VERSION || helper.version;
if (platform === 'linux') {
if (process.arch === 'arm64' || process.arch === 'x64') {
platform += '64';
} else {
console.log('Only Linux 64 bits supported.');
process.exit(1);
}
} else if (platform === 'darwin' || platform === 'freebsd') {
if (process.arch === 'x64') {
// @ts-ignore
platform = 'mac64';
} else {
console.log('Only Mac 64 bits supported.');
process.exit(1);
}
} else if (platform !== 'win32') {
console.log('Unexpected platform or architecture:', process.platform, process.arch);
process.exit(1);
}
let tmpPath;
const chromedriverBinaryFileName = process.platform === 'win32' ? 'chromedriver.exe' : 'chromedriver';
let chromedriverBinaryFilePath;
let downloadedFile = '';
Promise.resolve().then(function () {
if (chromedriver_version === 'LATEST')
return getLatestVersion(getRequestOptions(cdnUrl + '/LATEST_RELEASE'));
})
.then(() => {
tmpPath = findSuitableTempDirectory();
chromedriverBinaryFilePath = path.resolve(tmpPath, chromedriverBinaryFileName );
})
.then(verifyIfChromedriverIsAvailableAndHasCorrectVersion)
.then(chromedriverIsAvailable => {
if (chromedriverIsAvailable) return;
console.log('Current existing ChromeDriver binary is unavailable, proceding with download and extraction.');
return downloadFile().then(extractDownload);
})
.then(() => copyIntoPlace(tmpPath, libPath))
.then(fixFilePermissions)
.then(() => console.log('Done. ChromeDriver binary available at', helper.path))
.catch(function (err) {
console.error('ChromeDriver installation failed', err);
process.exit(1);
});
function downloadFile() {
if (configuredfilePath) {
downloadedFile = configuredfilePath;
console.log('Using file: ', downloadedFile);
return Promise.resolve();
} else {
const fileName = `chromedriver_${platform}.zip`;
const tempDownloadedFile = path.resolve(tmpPath, fileName);
downloadedFile = tempDownloadedFile;
const formattedDownloadUrl = `${cdnUrl}/${chromedriver_version}/${fileName}`;
console.log('Downloading from file: ', formattedDownloadUrl);
console.log('Saving to file:', downloadedFile);
return requestBinary(getRequestOptions(formattedDownloadUrl), downloadedFile);
}
}
function verifyIfChromedriverIsAvailableAndHasCorrectVersion() {
if (!fs.existsSync(chromedriverBinaryFilePath))
return false;
const forceDownload = process.env.npm_config_chromedriver_force_download === 'true' || process.env.CHROMEDRIVER_FORCE_DOWNLOAD === 'true';
if (forceDownload)
return false;
console.log('ChromeDriver binary exists. Validating...');
const deferred = new Deferred();
try {
fs.accessSync(chromedriverBinaryFilePath, fs.constants.X_OK);
const cp = child_process.spawn(chromedriverBinaryFilePath, ['--version']);
let str = '';
cp.stdout.on('data', function (data) {
str += data;
});
cp.on('error', function () {
deferred.resolve(false);
});
cp.on('close', function (code) {
if (code !== 0)
return deferred.resolve(false);
const parts = str.split(' ');
if (parts.length < 3)
return deferred.resolve(false);
if (parts[1].startsWith(chromedriver_version)) {
console.log(str);
console.log(`ChromeDriver is already available at '${chromedriverBinaryFilePath}'.`);
return deferred.resolve(true);
}
deferred.resolve(false);
});
}
catch (error) {
deferred.resolve(false);
}
return deferred.promise;
}
function findSuitableTempDirectory() {
const now = Date.now();
const candidateTmpDirs = [
process.env.TMPDIR || process.env.TMP || process.env.npm_config_tmp,
os.tmpdir(),
'/tmp',
path.join(process.cwd(), 'tmp')
];
for (let i = 0; i < candidateTmpDirs.length; i++) {
if (!candidateTmpDirs[i]) continue;
// Prevent collision with other versions in the dependency tree
const namespace = chromedriver_version;
const candidatePath = path.join(candidateTmpDirs[i], namespace, 'chromedriver');
try {
mkdirp.sync(candidatePath, '0777');
const testFile = path.join(candidatePath, now + '.tmp');
fs.writeFileSync(testFile, 'test');
fs.unlinkSync(testFile);
return candidatePath;
} catch (e) {
console.log(candidatePath, 'is not writable:', e.message);
}
}
console.error('Can not find a writable tmp directory, please report issue on https://github.com/giggio/chromedriver/issues/ with as much information as possible.');
process.exit(1);
}
function getRequestOptions(downloadPath) {
const options = {uri: downloadPath, method: 'GET'};
const protocol = options.uri.substring(0, options.uri.indexOf('//'));
const proxyUrl = protocol === 'https:'
? process.env.npm_config_https_proxy
: (process.env.npm_config_proxy || process.env.npm_config_http_proxy);
if (proxyUrl) {
options.proxy = proxyUrl;
}
options.strictSSL = !!process.env.npm_config_strict_ssl;
// Use certificate authority settings from npm
let ca = process.env.npm_config_ca;
// Parse ca string like npm does
if (ca && ca.match(/^".*"$/)) {
try {
ca = JSON.parse(ca.trim());
} catch (e) {
console.error('Could not parse ca string', process.env.npm_config_ca, e);
}
}
if (!ca && process.env.npm_config_cafile) {
try {
ca = fs.readFileSync(process.env.npm_config_cafile, {encoding: 'utf8'})
.split(/\n(?=-----BEGIN CERTIFICATE-----)/g);
// Comments at the beginning of the file result in the first
// item not containing a certificate - in this case the
// download will fail
if (ca.length > 0 && !/-----BEGIN CERTIFICATE-----/.test(ca[0])) {
ca.shift();
}
} catch (e) {
console.error('Could not read cafile', process.env.npm_config_cafile, e);
}
}
if (ca) {
console.log('Using npmconf ca');
options.agentOptions = {
ca: ca
};
options.ca = ca;
}
// Use specific User-Agent
if (process.env.npm_config_user_agent) {
options.headers = {'User-Agent': process.env.npm_config_user_agent};
}
return options;
}
function getLatestVersion(requestOptions) {
const deferred = new Deferred();
request(requestOptions, function (err, response, data) {
if (err) {
deferred.reject('Error with http(s) request: ' + err);
} else {
chromedriver_version = data.trim();
deferred.resolve(true);
}
});
return deferred.promise;
}
function requestBinary(requestOptions, filePath) {
const deferred = new Deferred();
let count = 0;
let notifiedCount = 0;
const outFile = fs.openSync(filePath, 'w');
const client = request(requestOptions);
client.on('error', function (err) {
deferred.reject('Error with http(s) request: ' + err);
});
client.on('data', function (data) {
fs.writeSync(outFile, data, 0, data.length, null);
count += data.length;
if ((count - notifiedCount) > 800000) {
console.log('Received ' + Math.floor(count / 1024) + 'K...');
notifiedCount = count;
}
});
client.on('end', function () {
console.log('Received ' + Math.floor(count / 1024) + 'K total.');
fs.closeSync(outFile);
deferred.resolve(true);
});
return deferred.promise;
}
function extractDownload() {
if (path.extname(downloadedFile) !== '.zip') {
fs.copyFileSync(downloadedFile, path.resolve(tmpPath, 'chromedriver'));
console.log('Skipping zip extraction - binary file found.');
return Promise.resolve();
}
const deferred = new Deferred();
console.log('Extracting zip contents');
extractZip(path.resolve(downloadedFile), { dir: tmpPath }, function (err) {
if (err) {
deferred.reject('Error extracting archive: ' + err);
} else {
deferred.resolve(true);
}
});
return deferred.promise;
}
function copyIntoPlace(originPath, targetPath) {
return del(targetPath)
.then(function() {
console.log("Copying to target path", targetPath);
fs.mkdirSync(targetPath);
// Look for the extracted directory, so we can rename it.
const files = fs.readdirSync(originPath);
const promises = files.map(function(name) {
const deferred = new Deferred();
const file = path.join(originPath, name);
const reader = fs.createReadStream(file);
const targetFile = path.join(targetPath, name);
const writer = fs.createWriteStream(targetFile);
writer.on("close", function() {
deferred.resolve(true);
});
reader.pipe(writer);
return deferred.promise;
});
return Promise.all(promises);
});
}
function fixFilePermissions() {
// Check that the binary is user-executable and fix it if it isn't (problems with unzip library)
if (process.platform != 'win32') {
const stat = fs.statSync(helper.path);
// 64 == 0100 (no octal literal in strict mode)
if (!(stat.mode & 64)) {
console.log('Fixing file permissions');
fs.chmodSync(helper.path, '755');
}
}
}
function Deferred() {
this.resolve = null;
this.reject = null;
this.promise = new Promise(function (resolve, reject) {
this.resolve = resolve;
this.reject = reject;
}.bind(this));
Object.freeze(this);
}
const fs = require('fs');
const path = require('path');
const tcpPortUsed = require('tcp-port-used');
function getPortFromArgs(args) {
let port = 9515;
if (!args){
return port;
}
const portRegexp = /--port=(\d*)/;
const portArg = args.find(function (arg) {
return portRegexp.test(arg);
});
if (portArg){
port = parseInt(portRegexp.exec(portArg)[1]);
}
return port;
}
process.env.PATH = path.join(__dirname, 'chromedriver') + path.delimiter + process.env.PATH;
exports.path = process.platform === 'win32' ? path.join(__dirname, 'chromedriver', 'chromedriver.exe') : path.join(__dirname, 'chromedriver', 'chromedriver');
exports.version = '2.46';
exports.start = function(args, returnPromise) {
let command = exports.path;
if (!fs.existsSync(command)) {
console.log('Could not find chromedriver in default path: ', command);
console.log('Falling back to use global chromedriver bin');
command = process.platform === 'win32' ? 'chromedriver.exe' : 'chromedriver';
}
const cp = require('child_process').spawn(command, args);
cp.stdout.pipe(process.stdout);
cp.stderr.pipe(process.stderr);
exports.defaultInstance = cp;
if (!returnPromise) {
return cp;
}
const port = getPortFromArgs(args);
const pollInterval = 100;
const timeout = 10000;
return tcpPortUsed.waitUntilUsed(port, pollInterval, timeout)
.then(function () {
return cp;
});
};
exports.stop = function () {
if (exports.defaultInstance != null){
exports.defaultInstance.kill();
}
};
{
"name": "chromedriver",
"version": "2.46.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "chromedriver",
"version": "2.46.0",
"hasInstallScript": true,
"license": "Apache-2.0",
"dependencies": {
"del": "^3.0.0",
"extract-zip": "^1.6.7",
"mkdirp": "^0.5.1",
"request": "^2.88.0",
"tcp-port-used": "^1.0.1"
},
"bin": {
"chromedriver": "bin/chromedriver"
}
},
"node_modules/ajv": {
"version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
"dependencies": {
"fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/epoberezkin"
}
},
"node_modules/array-union": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz",
"integrity": "sha512-Dxr6QJj/RdU/hCaBjOfxW+q6lyuVE6JFWIrAUpuOOhoJJoQ99cUn3igRaHVB5P9WrgFVN0FfArM3x0cueOU8ng==",
"dependencies": {
"array-uniq": "^1.0.1"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/array-uniq": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz",
"integrity": "sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/asn1": {
"version": "0.2.6",
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz",
"integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==",
"dependencies": {
"safer-buffer": "~2.1.0"
}
},
"node_modules/assert-plus": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
"integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==",
"engines": {
"node": ">=0.8"
}
},
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"node_modules/aws-sign2": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
"integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==",
"engines": {
"node": "*"
}
},
"node_modules/aws4": {
"version": "1.12.0",
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz",
"integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg=="
},
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
"node_modules/bcrypt-pbkdf": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
"integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==",
"dependencies": {
"tweetnacl": "^0.14.3"
}
},
"node_modules/brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"node_modules/buffer-crc32": {
"version": "0.2.13",
"resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
"integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==",
"engines": {
"node": "*"
}
},
"node_modules/buffer-from": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="
},
"node_modules/caseless": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
"integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw=="
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="
},
"node_modules/concat-stream": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
"integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
"engines": [
"node >= 0.8"
],
"dependencies": {
"buffer-from": "^1.0.0",
"inherits": "^2.0.3",
"readable-stream": "^2.2.2",
"typedarray": "^0.0.6"
}
},
"node_modules/core-util-is": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
},
"node_modules/dashdash": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
"integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==",
"dependencies": {
"assert-plus": "^1.0.0"
},
"engines": {
"node": ">=0.10"
}
},
"node_modules/debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"dependencies": {
"ms": "2.0.0"
}
},
"node_modules/deep-is": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
"integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ=="
},
"node_modules/del": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz",
"integrity": "sha512-7yjqSoVSlJzA4t/VUwazuEagGeANEKB3f/aNI//06pfKgwoCb7f6Q1gETN1sZzYaj6chTQ0AhIwDiPdfOjko4A==",
"dependencies": {
"globby": "^6.1.0",
"is-path-cwd": "^1.0.0",
"is-path-in-cwd": "^1.0.0",
"p-map": "^1.1.1",
"pify": "^3.0.0",
"rimraf": "^2.2.8"
},
"engines": {
"node": ">=4"
}
},
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/ecc-jsbn": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
"integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==",
"dependencies": {
"jsbn": "~0.1.0",
"safer-buffer": "^2.1.0"
}
},
"node_modules/extend": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
"integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="
},
"node_modules/extract-zip": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz",
"integrity": "sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==",
"dependencies": {
"concat-stream": "^1.6.2",
"debug": "^2.6.9",
"mkdirp": "^0.5.4",
"yauzl": "^2.10.0"
},
"bin": {
"extract-zip": "cli.js"
}
},
"node_modules/extsprintf": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
"integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==",
"engines": [
"node >=0.6.0"
]
},
"node_modules/fast-deep-equal": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
},
"node_modules/fast-json-stable-stringify": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="
},
"node_modules/fd-slicer": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
"integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==",
"dependencies": {
"pend": "~1.2.0"
}
},
"node_modules/forever-agent": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
"integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==",
"engines": {
"node": "*"
}
},
"node_modules/form-data": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
"integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.6",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 0.12"
}
},
"node_modules/fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="
},
"node_modules/getpass": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
"integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==",
"dependencies": {
"assert-plus": "^1.0.0"
}
},
"node_modules/glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.1.1",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
},
"engines": {
"node": "*"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/globby": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz",
"integrity": "sha512-KVbFv2TQtbzCoxAnfD6JcHZTYCzyliEaaeM/gH8qQdkKr5s0OP9scEgvdcngyk7AVdY6YVW/TJHd+lQ/Df3Daw==",
"dependencies": {
"array-union": "^1.0.1",
"glob": "^7.0.3",
"object-assign": "^4.0.1",
"pify": "^2.0.0",
"pinkie-promise": "^2.0.0"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/globby/node_modules/pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/har-schema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
"integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==",
"engines": {
"node": ">=4"
}
},
"node_modules/har-validator": {
"version": "5.1.5",
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz",
"integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==",
"deprecated": "this library is no longer supported",
"dependencies": {
"ajv": "^6.12.3",
"har-schema": "^2.0.0"
},
"engines": {
"node": ">=6"
}
},
"node_modules/http-signature": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
"integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==",
"dependencies": {
"assert-plus": "^1.0.0",
"jsprim": "^1.2.2",
"sshpk": "^1.7.0"
},
"engines": {
"node": ">=0.8",
"npm": ">=1.3.7"
}
},
"node_modules/inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
"dependencies": {
"once": "^1.3.0",
"wrappy": "1"
}
},
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"node_modules/ip-regex": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.3.0.tgz",
"integrity": "sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==",
"engines": {
"node": ">=8"
}
},
"node_modules/is-path-cwd": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz",
"integrity": "sha512-cnS56eR9SPAscL77ik76ATVqoPARTqPIVkMDVxRaWH06zT+6+CzIroYRJ0VVvm0Z1zfAvxvz9i/D3Ppjaqt5Nw==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/is-path-in-cwd": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz",
"integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==",
"dependencies": {
"is-path-inside": "^1.0.0"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/is-path-inside": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz",
"integrity": "sha512-qhsCR/Esx4U4hg/9I19OVUAJkGWtjRYHMRgUMZE2TDdj+Ag+kttZanLupfddNyglzz50cUlmWzUaI37GDfNx/g==",
"dependencies": {
"path-is-inside": "^1.0.1"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/is-typedarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
"integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA=="
},
"node_modules/is-url": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/is-url/-/is-url-1.2.4.tgz",
"integrity": "sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww=="
},
"node_modules/is2": {
"version": "2.0.9",
"resolved": "https://registry.npmjs.org/is2/-/is2-2.0.9.tgz",
"integrity": "sha512-rZkHeBn9Zzq52sd9IUIV3a5mfwBY+o2HePMh0wkGBM4z4qjvy2GwVxQ6nNXSfw6MmVP6gf1QIlWjiOavhM3x5g==",
"dependencies": {
"deep-is": "^0.1.3",
"ip-regex": "^4.1.0",
"is-url": "^1.2.4"
},
"engines": {
"node": ">=v0.10.0"
}
},
"node_modules/isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="
},
"node_modules/isstream": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g=="
},
"node_modules/jsbn": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
"integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg=="
},
"node_modules/json-schema": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz",
"integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA=="
},
"node_modules/json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
},
"node_modules/json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
"integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA=="
},
"node_modules/jsprim": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz",
"integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==",
"dependencies": {
"assert-plus": "1.0.0",
"extsprintf": "1.3.0",
"json-schema": "0.4.0",
"verror": "1.10.0"
},
"engines": {
"node": ">=0.6.0"
}
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dependencies": {
"mime-db": "1.52.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dependencies": {
"brace-expansion": "^1.1.7"
},
"engines": {
"node": "*"
}
},
"node_modules/minimist": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/mkdirp": {
"version": "0.5.6",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
"integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
"dependencies": {
"minimist": "^1.2.6"
},
"bin": {
"mkdirp": "bin/cmd.js"
}
},
"node_modules/ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
},
"node_modules/oauth-sign": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
"integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==",
"engines": {
"node": "*"
}
},
"node_modules/object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"dependencies": {
"wrappy": "1"
}
},
"node_modules/p-map": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz",
"integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==",
"engines": {
"node": ">=4"
}
},
"node_modules/path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/path-is-inside": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz",
"integrity": "sha512-DUWJr3+ULp4zXmol/SZkFf3JGsS9/SIv+Y3Rt93/UjPpDpklB5f1er4O3POIbUuUJ3FXgqte2Q7SrU6zAqwk8w=="
},
"node_modules/pend": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
"integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg=="
},
"node_modules/performance-now": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
"integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow=="
},
"node_modules/pify": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==",
"engines": {
"node": ">=4"
}
},
"node_modules/pinkie": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
"integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/pinkie-promise": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
"integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==",
"dependencies": {
"pinkie": "^2.0.0"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
},
"node_modules/psl": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz",
"integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag=="
},
"node_modules/punycode": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
"engines": {
"node": ">=6"
}
},
"node_modules/qs": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz",
"integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==",
"engines": {
"node": ">=0.6"
}
},
"node_modules/readable-stream": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
"dependencies": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"node_modules/request": {
"version": "2.88.2",
"resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",
"integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==",
"deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142",
"dependencies": {
"aws-sign2": "~0.7.0",
"aws4": "^1.8.0",
"caseless": "~0.12.0",
"combined-stream": "~1.0.6",
"extend": "~3.0.2",
"forever-agent": "~0.6.1",
"form-data": "~2.3.2",
"har-validator": "~5.1.3",
"http-signature": "~1.2.0",
"is-typedarray": "~1.0.0",
"isstream": "~0.1.2",
"json-stringify-safe": "~5.0.1",
"mime-types": "~2.1.19",
"oauth-sign": "~0.9.0",
"performance-now": "^2.1.0",
"qs": "~6.5.2",
"safe-buffer": "^5.1.2",
"tough-cookie": "~2.5.0",
"tunnel-agent": "^0.6.0",
"uuid": "^3.3.2"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/rimraf": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
"integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
"dependencies": {
"glob": "^7.1.3"
},
"bin": {
"rimraf": "bin.js"
}
},
"node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"node_modules/sshpk": {
"version": "1.18.0",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.18.0.tgz",
"integrity": "sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==",
"dependencies": {
"asn1": "~0.2.3",
"assert-plus": "^1.0.0",
"bcrypt-pbkdf": "^1.0.0",
"dashdash": "^1.12.0",
"ecc-jsbn": "~0.1.1",
"getpass": "^0.1.1",
"jsbn": "~0.1.0",
"safer-buffer": "^2.0.2",
"tweetnacl": "~0.14.0"
},
"bin": {
"sshpk-conv": "bin/sshpk-conv",
"sshpk-sign": "bin/sshpk-sign",
"sshpk-verify": "bin/sshpk-verify"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"dependencies": {
"safe-buffer": "~5.1.0"
}
},
"node_modules/tcp-port-used": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/tcp-port-used/-/tcp-port-used-1.0.2.tgz",
"integrity": "sha512-l7ar8lLUD3XS1V2lfoJlCBaeoaWo/2xfYt81hM7VlvR4RrMVFqfmzfhLVk40hAb368uitje5gPtBRL1m/DGvLA==",
"dependencies": {
"debug": "4.3.1",
"is2": "^2.0.6"
}
},
"node_modules/tcp-port-used/node_modules/debug": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
"integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
"dependencies": {
"ms": "2.1.2"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/tcp-port-used/node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"node_modules/tough-cookie": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
"integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
"dependencies": {
"psl": "^1.1.28",
"punycode": "^2.1.1"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/tunnel-agent": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
"integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
"dependencies": {
"safe-buffer": "^5.0.1"
},
"engines": {
"node": "*"
}
},
"node_modules/tweetnacl": {
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
"integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA=="
},
"node_modules/typedarray": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
"integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA=="
},
"node_modules/uri-js": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
"integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
"dependencies": {
"punycode": "^2.1.0"
}
},
"node_modules/util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
"node_modules/uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
"bin": {
"uuid": "bin/uuid"
}
},
"node_modules/verror": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
"integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==",
"engines": [
"node >=0.6.0"
],
"dependencies": {
"assert-plus": "^1.0.0",
"core-util-is": "1.0.2",
"extsprintf": "^1.2.0"
}
},
"node_modules/verror/node_modules/core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ=="
},
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
},
"node_modules/yauzl": {
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
"integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==",
"dependencies": {
"buffer-crc32": "~0.2.3",
"fd-slicer": "~1.1.0"
}
}
}
}
{
"_args": [
[
"[email protected]",
"C:\\Users\\ts-shijia.a.yu\\IdeaProjects\\jpp-qa_automation_all_nodejs_new"
]
],
"_from": "[email protected]",
"_id": "[email protected]",
"_inBundle": false,
"_integrity": "sha512-dLtKIJW3y/PuFrPmcw6Mb8Nh+HwSqgVrK1rWgTARXhHfWvV822X2VRkx2meU/tg2+YQL6/nNgT6n5qWwIDHbwg==",
"_location": "/chromedriver",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "[email protected]",
"name": "chromedriver",
"escapedName": "chromedriver",
"rawSpec": "2.46.0",
"saveSpec": null,
"fetchSpec": "2.46.0"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-2.46.0.tgz",
"_spec": "2.46.0",
"_where": "C:\\Users\\ts-shijia.a.yu\\IdeaProjects\\jpp-qa_automation_all_nodejs_new",
"author": {
"name": "Giovanni Bassi",
"email": "[email protected]",
"url": "http://www.lambda3.com.br"
},
"bin": {
"chromedriver": "./bin/chromedriver"
},
"bugs": {
"url": "https://github.com/giggio/node-chromedriver/issues"
},
"dependencies": {
"del": "^3.0.0",
"extract-zip": "^1.6.7",
"mkdirp": "^0.5.1",
"request": "^2.88.0",
"tcp-port-used": "^1.0.1"
},
"description": "ChromeDriver for Selenium",
"homepage": "https://github.com/giggio/node-chromedriver",
"keywords": [
"chromedriver",
"selenium"
],
"license": "Apache-2.0",
"main": "lib/chromedriver",
"name": "chromedriver",
"repository": {
"type": "git",
"url": "git://github.com/giggio/node-chromedriver.git"
},
"scripts": {
"install": "node install.js"
},
"version": "2.46.0"
}
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2014 Giovanni Bassi and Elemar Jr.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
# ChromeDriver
[![Build app](https://github.com/giggio/node-chromedriver/actions/workflows/build.yml/badge.svg)](https://github.com/giggio/node-chromedriver/actions/workflows/build.yml)
[![npm](https://img.shields.io/npm/dt/chromedriver.svg)](https://www.npmjs.com/package/chromedriver)
An NPM wrapper for Selenium [ChromeDriver](https://sites.google.com/chromium.org/driver/).
## Building and Installing
```shell
npm install chromedriver
```
Or grab the source and
```shell
node ./install.js
```
What this is really doing is just grabbing a particular "blessed" (by
this module) version of ChromeDriver. As new versions are released
and vetted, this module will be updated accordingly.
The package has been set up to fetch and run ChromeDriver for MacOS (darwin),
Linux based platforms (as identified by Node.js), and Windows. If you
spot any platform weirdness, let us know or send a patch.
## Force download
By default this package, when installed, will search for an existing
Chromedriver binary in your configured temp directory. If found, and it is the
correct version, it will simply copy it to your node_modules directory. You can
force it always download by configuring it:
```shell
npm install chromedriver --chromedriver-force-download
```
Or add property to your [`.npmrc`](https://docs.npmjs.com/files/npmrc) file.
```ini
chromedriver_force_download=true
```
Another option is to use PATH variable `CHROMEDRIVER_FORCE_DOWNLOAD`.
```shell
CHROMEDRIVER_FORCE_DOWNLOAD=true npm install chromedriver
```
## Custom binaries url
This allows you to use your own endpoints for metadata and binaries. It is useful in air gapped
scenarios or if you have download restrictions, such as firewalls.
This was changed for version 115 and greater
([see details](https://groups.google.com/g/chromedriver-users/c/clpipqvOGjE)),
but implemented in this package starting with version
`114.0.2`. To see the configuration to prior versions check out this
[README.md](https://github.com/giggio/node-chromedriver/tree/114.0.1#custom-binaries-url)
at the latest tag where it was using the legacy urls (`114.0.1`).
### For versions >= 115
There are two urls that need to be configured, one for metadata and one for binaries.
The one for metadata is the "CDN url", and the one for binaries is the "CDN binaries url".
See [Chrome for Testing](https://googlechromelabs.github.io/chrome-for-testing/) to understand
how these urls work.
Npm config:
For metadata use `chromedriver_cdnurl`. The default is `https://googlechromelabs.github.io`. You need to either supply the binary download endpoint, or the binaries url config, see bellow.
For binaries use `chromedriver_cdnbinariesurl`. The default is to search for the download url using
`$chromedriver_cdnurl/chrome-for-testing/[version].json`, which forms a URL like:
https://googlechromelabs.github.io/chrome-for-testing/122.0.6261.57.json.
The resulting url will be something like:
https://storage.googleapis.com/chrome-for-testing-public/122.0.6261.57/linux64/chromedriver-linux64.zip.
Keep in mind that this last url is just an example and it might change (as it has happened in the past).
```shell
npm install chromedriver --chromedriver_cdnurl=https://npmmirror.com/metadata --chromedriver_cdnbinariesurl=https://npmmirror.com/binaries
```
Or add these properties to your [`.npmrc`](https://docs.npmjs.com/cli/configuring-npm/npmrc) file:
```ini
chromedriver_cdnurl=https://npmmirror.com/metadata
chromedriver_cdnbinariesurl=https://npmmirror.com/binaries
```
Another option is to use the environment variables `CHROMEDRIVER_CDNURL` and `CHROMEDRIVER_CDNBINARIESURL`.
```shell
CHROMEDRIVER_CDNURL=https://npmmirror.com/metadata CHROMEDRIVER_CDNBINARIESURL=https://npmmirror.com/binaries npm install chromedriver
```
### For versions < 115
There is one url to both metadata and binaries.
To use a mirror of the ChromeDriver binaries use npm config property `chromedriver_legacy_cdnurl`.
Default is `https://chromedriver.storage.googleapis.com`.
```shell
npm install chromedriver --chromedriver_legacy_cdnurl=https://npmmirror.com/mirrors/chromedriver --chromedriver_version=LATEST_114
```
Or add a property to your [`.npmrc`](https://docs.npmjs.com/files/npmrc) file:
```ini
chromedriver_legacy_cdnurl=https://npmmirror.com/mirrors/chromedriver
```
Another option is to use the environment variable `CHROMEDRIVER_LEGACY_CDNURL`.
```shell
CHROMEDRIVER_LEGACY_CDNURL=https://npmmirror.com/mirrors/chromedriver npm install chromedriver --chromedriver_version=LATEST_114
```
## Custom binaries file
To get the chromedriver from the filesystem instead of a web request use the npm config property `chromedriver_filepath`.
```shell
npm install chromedriver --chromedriver_filepath=/path/to/chromedriver_mac64.zip
```
Or add property to your [`.npmrc`](https://docs.npmjs.com/files/npmrc) file.
```ini
chromedriver_filepath=/path/to/chromedriver_mac64.zip
```
Another option is to use the PATH variable `CHROMEDRIVER_FILEPATH`
```shell
CHROMEDRIVER_FILEPATH=/path/to/chromedriver_mac64.zip
```
This variable can be used to set either a `.zip` file or the binary itself, eg:
```shell
CHROMEDRIVER_FILEPATH=/bin/chromedriver
```
## Custom download options
Install through a proxy.
```shell
npm config set proxy http://[user:pwd]@domain.tld:port
npm config set https-proxy http://[user:pwd]@domain.tld:port
```
Use different User-Agent.
```shell
npm config set user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0"
```
## Skipping chromedriver download
You may wish to skip the downloading of the chromedriver binary file, for example if you know for certain that it is already there or if you want to use a system binary and just use this module as an interface to interact with it.
To achieve this you can use the npm config property `chromedriver_skip_download`.
```shell
npm install chromedriver --chromedriver_skip_download=true
```
Or add property to your [`.npmrc`](https://docs.npmjs.com/files/npmrc) file.
```ini
chromedriver_skip_download=true
```
Another option is to use the PATH variable `CHROMEDRIVER_SKIP_DOWNLOAD`
```shell
CHROMEDRIVER_SKIP_DOWNLOAD=true
```
## Running
```shell
bin/chromedriver [arguments]
```
And npm will install a link to the binary in `node_modules/.bin` as
it is wont to do.
## Running with Selenium WebDriver
```javascript
require('chromedriver');
var webdriver = require('selenium-webdriver');
var driver = new webdriver.Builder()
.forBrowser('chrome')
.build();
```
(Tested for selenium-webdriver version `2.48.2`)
The path will be added to the process automatically, you don't need to configure it.
But you can get it from `require('chromedriver').path` if you want it.
## Running via node
The package exports a `path` string that contains the path to the
chromedriver binary/executable.
Below is an example of using this package via node.
```javascript
var childProcess = require('child_process');
var chromedriver = require('chromedriver');
var binPath = chromedriver.path;
var childArgs = [
'some argument'
];
childProcess.execFile(binPath, childArgs, function(err, stdout, stderr) {
// handle results
});
```
You can also use the start and stop methods:
```javascript
var chromedriver = require('chromedriver');
args = [
// optional arguments
];
chromedriver.start(args);
// run your tests
chromedriver.stop();
```
With the latest version, you can optionally receive a Promise from the `chromedriver.start` function:
```javascript
var returnPromise = true;
chromedriver
.start(args, returnPromise)
.then(() => {
console.log('chromedriver is ready');
});
```
Note: if your tests are ran asynchronously, chromedriver.stop() will have to be
executed as a callback at the end of your tests
## Versioning
The NPM package version tracks the version of chromedriver that will be installed,
with an additional build number that is used for revisions to the installer.
You can use the package version number to install a specific version, or use the
setting to a specific version. If there is a new Chromedriver version available which is not yet available as a version of `node-chromedriver`, the npm command `npm run update-chromedriver` in this repository can be used to make the required updates to this module, please submit the change as a PR. To always install the latest version of Chromedriver,
use `LATEST` as the version number:
```shell
npm install chromedriver --chromedriver_version=LATEST
```
Or add property to your [`.npmrc`](https://docs.npmjs.com/files/npmrc) file.
```ini
chromedriver_version=LATEST
```
Another option is to use env variable `CHROMEDRIVER_VERSION`.
```shell
CHROMEDRIVER_VERSION=LATEST npm install chromedriver
```
You can force the latest release for a specific major version by specifying `LATEST_{VERSION_NUMBER}`:
```shell
CHROMEDRIVER_VERSION=LATEST_80 npm install chromedriver
```
You can also force a different version of chromedriver by replacing `LATEST` with a version number:
```shell
CHROMEDRIVER_VERSION=75.0.3770.140 npm install chromedriver
```
## Detect ChromeDriver Version
The NPM package version may not be always compatible to your Chrome version.
To get the chromedriver that corresponds to the version of Chrome installed,
you can use the npm config property `detect_chromedriver_version`.
```shell
npm install chromedriver --detect_chromedriver_version
```
Or add property to your [`.npmrc`](https://docs.npmjs.com/files/npmrc) file.
```ini
detect_chromedriver_version=true
```
Another option is to use environment variable `DETECT_CHROMEDRIVER_VERSION`.
```shell
DETECT_CHROMEDRIVER_VERSION=true npm install chromedriver
```
**Note:** When the property `detect_chromedriver_version` is provided,
`chromedriver_version` and `chromedriver_filepath` properties are ignored.
## Include Chromium
If you don't have Chrome installed, you can check for Chromium version instead by setting the argument `include_chromium` to `true`.
```shell
npm install chromedriver --include_chromium
```
Or add property to your [`.npmrc`](https://docs.npmjs.com/files/npmrc) file.
```ini
include_chromium=true
```
Another option is to use environment variable `INCLUDE_CHROMIUM`.
```shell
INCLUDE_CHROMIUM=true npm install chromedriver
```
**Note:** The property `INCLUDE_CHROMIUM` is ignored if the property `DETECT_CHROMEDRIVER_VERSION` is not used.
## A Note on chromedriver
Chromedriver is not a library for NodeJS.
This is an _NPM wrapper_ and can be used to conveniently make ChromeDriver available.
It is not a Node.js wrapper.
## Supported Node.js versions
We will do our best to support every supported Node.js versions.
See [nodejs/Release](https://github.com/nodejs/Release) for
the current supported versions. You can also view our
[build scripts](https://github.com/giggio/node-chromedriver/blob/main/.github/workflows/build.yml#L41) and check the versions there.
## Contributing
Questions, comments, bug reports, and pull requests are all welcome. Submit them at
[the project on GitHub](https://github.com/giggio/node-chromedriver/).
Bug reports that include steps-to-reproduce (including code) are the
best. Even better, make them in the form of pull requests.
We have added
[VS Code Remote support with containers](https://code.visualstudio.com/docs/remote/containers).
If you are on Windows, set `git config core.autocrlf input` so you don't get git errors.
## Author
[Giovanni Bassi](https://github.com/giggio), with collaboration from
[lots of good people](https://github.com/giggio/node-chromedriver/graphs/contributors).
Thanks for Obvious and their PhantomJS project for heavy inspiration! Check their project on [Github](https://github.com/Obvious/phantomjs/).
## License
Licensed under the Apache License, Version 2.0.
#!/usr/bin/env node
const path = require("path");
const spawn = require("child_process").spawn;
const binPath = require(path.join(__dirname, "..", "lib", "chromedriver")).path;
const args = process.argv.slice(2);
const cp = spawn(binPath, args);
cp.stdout.pipe(process.stdout);
cp.stderr.pipe(process.stderr);
cp.on("exit", process.exit);
process.on("SIGTERM", function() {
cp.kill("SIGTERM");
process.exit(1);
});
\ No newline at end of file
'use strict';
// @ts-check
const fs = require('node:fs');
const helper = require('./lib/chromedriver');
const axios = require('axios').default;
const path = require('node:path');
const child_process = require('node:child_process');
const os = require('node:os');
const { ProxyAgent } = require('proxy-agent');
const { promisify } = require('node:util');
const { finished } = require('node:stream');
const extractZip = require('extract-zip');
const { getChromeVersion } = require('@testim/chrome-version');
const { compareVersions } = require('compare-versions');
const finishedAsync = promisify(finished);
const process = require('node:process');
const console = require('node:console');
class Installer {
async install() {
const skipDownload = (process.env.npm_config_chromedriver_skip_download || process.env.CHROMEDRIVER_SKIP_DOWNLOAD) === 'true';
if (skipDownload) {
console.log('Found CHROMEDRIVER_SKIP_DOWNLOAD variable, skipping installation.');
process.exit(0);
}
const cdnUrl = (process.env.npm_config_chromedriver_cdnurl || process.env.CHROMEDRIVER_CDNURL || 'https://googlechromelabs.github.io').replace(/\/+$/, '');
const legacyCdnUrl = (process.env.npm_config_chromedriver_legacy_cdnurl || process.env.CHROMEDRIVER_LEGACY_CDNURL || 'https://chromedriver.storage.googleapis.com').replace(/\/+$/, '');
let chromedriverVersion = process.env.npm_config_chromedriver_version || process.env.CHROMEDRIVER_VERSION || helper.version;
const detectChromedriverVersion = (process.env.npm_config_detect_chromedriver_version || process.env.DETECT_CHROMEDRIVER_VERSION) === 'true';
try {
if (detectChromedriverVersion) {
const includeChromium = (process.env.npm_config_include_chromium || process.env.INCLUDE_CHROMIUM) === 'true';
// Refer http://chromedriver.chromium.org/downloads/version-selection
const chromeVersion = await getChromeVersion(includeChromium);
console.log("Your Chrome version is " + chromeVersion);
const versionMatch = /^(.*?)\.\d+$/.exec(chromeVersion);
if (versionMatch) {
chromedriverVersion = await this.getChromeDriverVersion(cdnUrl, legacyCdnUrl, parseInt(versionMatch[1]));
console.log("Compatible ChromeDriver version is " + chromedriverVersion);
}
} else if (chromedriverVersion === 'LATEST') {
chromedriverVersion = await this.getChromeDriverVersion(cdnUrl, legacyCdnUrl);
} else {
const latestReleaseForVersionMatch = chromedriverVersion.match(/LATEST_(\d+)/);
if (latestReleaseForVersionMatch) {
chromedriverVersion = await this.getChromeDriverVersion(cdnUrl, legacyCdnUrl, parseInt(latestReleaseForVersionMatch[1]));
}
}
let tmpPath = this.findSuitableTempDirectory(chromedriverVersion);
const extractDirectory = tmpPath;
const majorVersion = parseInt(chromedriverVersion.split('.')[0]);
const useLegacyMethod = majorVersion <= 114;
const platform = this.getPlatform(chromedriverVersion);
let downloadedFile = this.getDownloadFilePath(useLegacyMethod, tmpPath, platform);
if (!useLegacyMethod)
tmpPath = path.join(tmpPath, path.basename(downloadedFile, path.extname(downloadedFile)));
const chromedriverBinaryFileName = process.platform === 'win32' ? 'chromedriver.exe' : 'chromedriver';
const chromedriverBinaryFilePath = path.resolve(tmpPath, chromedriverBinaryFileName);
const chromedriverIsAvailable = await this.verifyIfChromedriverIsAvailableAndHasCorrectVersion(chromedriverVersion, chromedriverBinaryFilePath);
if (!chromedriverIsAvailable) {
console.log('Current existing ChromeDriver binary is unavailable, proceeding with download and extraction.');
const configuredfilePath = process.env.npm_config_chromedriver_filepath || process.env.CHROMEDRIVER_FILEPATH;
if (configuredfilePath) {
console.log('Using file: ', configuredfilePath);
downloadedFile = configuredfilePath;
} else {
if (useLegacyMethod)
await this.downloadFileLegacy(legacyCdnUrl, downloadedFile, chromedriverVersion);
else
await this.downloadFile(cdnUrl, downloadedFile, chromedriverVersion, platform);
}
await this.extractDownload(extractDirectory, chromedriverBinaryFilePath, downloadedFile);
}
const libPath = path.join(__dirname, 'lib', 'chromedriver');
await this.copyIntoPlace(tmpPath, libPath);
this.fixFilePermissions();
console.log('Done. ChromeDriver binary available at', helper.path);
} catch (err) {
console.error('ChromeDriver installation failed', err);
process.exit(1);
}
}
/**
* @param {string} chromedriverVersion
*/
getPlatform(chromedriverVersion) {
const thePlatform = process.platform;
if (thePlatform === 'linux') {
if (process.arch === 'arm64' || process.arch === 's390x' || process.arch === 'x64') {
return 'linux64';
} else {
console.error('Only Linux 64 bits supported.');
process.exit(1);
}
} else if (thePlatform === 'darwin' || thePlatform === 'freebsd') {
const osxPlatform = this.getMacOsRealArch(chromedriverVersion);
if (!osxPlatform) {
console.error('Only Mac 64 bits supported.');
process.exit(1);
}
return osxPlatform;
} else if (thePlatform === 'win32') {
if (compareVersions(chromedriverVersion, '115') < 0) {
return 'win32';
}
return (process.arch === 'x64') ? 'win64' : 'win32';
}
console.error('Unexpected platform or architecture:', process.platform, process.arch);
process.exit(1);
}
/**
* @param {string} cdnUrl
* @param {string} downloadedFile
* @param {string} chromedriverVersion
* @param {string} platform
*/
async downloadFile(cdnUrl, downloadedFile, chromedriverVersion, platform) {
const cdnBinariesUrl = (process.env.npm_config_chromedriver_cdnbinariesurl || process.env.CHROMEDRIVER_CDNBINARIESURL)?.replace(/\/+$/, '');
const url = cdnBinariesUrl
? `${cdnBinariesUrl}/${chromedriverVersion}/${platform}/${path.basename(downloadedFile)}`
: await this.getDownloadUrl(cdnUrl, chromedriverVersion, platform);
if (!url) {
console.error(`Download url could not be found for version ${chromedriverVersion} and platform '${platform}'`);
process.exit(1);
}
console.log('Downloading from file: ', url);
await this.requestBinary(this.getRequestOptions(url), downloadedFile);
}
/**
* @param {string} cdnUrl
* @param {string} downloadedFile
* @param {string} chromedriverVersion
*/
async downloadFileLegacy(cdnUrl, downloadedFile, chromedriverVersion) {
const url = `${cdnUrl}/${chromedriverVersion}/${path.basename(downloadedFile)}`;
console.log('Downloading from file: ', url);
await this.requestBinary(this.getRequestOptions(url), downloadedFile);
}
/**
* @param {any} useLegacyPath
* @param {string} dirToLoadTo
* @param {string} platform
*/
getDownloadFilePath(useLegacyPath, dirToLoadTo, platform) {
const fileName = useLegacyPath ? `chromedriver_${platform}.zip` : `chromedriver-${platform}.zip`;
const downloadedFile = path.resolve(dirToLoadTo, fileName);
console.log('Saving to file:', downloadedFile);
return downloadedFile;
}
/**
* @param {string} chromedriverVersion
* @param {string} chromedriverBinaryFilePath
*/
verifyIfChromedriverIsAvailableAndHasCorrectVersion(chromedriverVersion, chromedriverBinaryFilePath) {
if (!fs.existsSync(chromedriverBinaryFilePath))
return Promise.resolve(false);
const forceDownload = process.env.npm_config_chromedriver_force_download === 'true' || process.env.CHROMEDRIVER_FORCE_DOWNLOAD === 'true';
if (forceDownload)
return Promise.resolve(false);
console.log('ChromeDriver binary exists. Validating...');
const deferred = new Deferred();
try {
fs.accessSync(chromedriverBinaryFilePath, fs.constants.X_OK);
const cp = child_process.spawn(chromedriverBinaryFilePath, ['--version']);
let str = '';
cp.stdout.on('data', data => str += data);
cp.on('error', () => deferred.resolve(false));
cp.on('close', code => {
if (code !== 0)
return deferred.resolve(false);
const parts = str.split(' ');
if (parts.length < 3)
return deferred.resolve(false);
if (parts[1].startsWith(chromedriverVersion)) {
console.log(`ChromeDriver is already available at '${chromedriverBinaryFilePath}'.`);
return deferred.resolve(true);
}
deferred.resolve(false);
});
}
catch (error) {
deferred.resolve(false);
}
return deferred.promise;
}
/**
* @param {string} chromedriverVersion
*/
findSuitableTempDirectory(chromedriverVersion) {
const now = Date.now();
const candidateTmpDirs = [
process.env.npm_config_tmp,
process.env.XDG_CACHE_HOME,
// Platform specific default, including TMPDIR/TMP/TEMP env
os.tmpdir(),
path.join(process.cwd(), 'tmp')
];
for (const tempDir of candidateTmpDirs) {
if (!tempDir) continue;
const namespace = chromedriverVersion;
const candidatePath = path.join(tempDir, namespace, 'chromedriver');
try {
fs.mkdirSync(candidatePath, { recursive: true });
const testFile = path.join(candidatePath, now + '.tmp');
fs.writeFileSync(testFile, 'test');
fs.unlinkSync(testFile);
return candidatePath;
} catch (e) {
console.log(candidatePath, 'is not writable:', e.message);
}
}
console.error('Can not find a writable tmp directory, please report issue on https://github.com/giggio/chromedriver/issues/ with as much information as possible.');
process.exit(1);
}
getRequestOptions(downloadPath) {
/** @type import('axios').AxiosRequestConfig */
const options = { url: downloadPath, method: "GET" };
const urlParts = new URL(downloadPath);
const isHttps = urlParts.protocol === 'https:';
if (isHttps) {
// Use certificate authority settings from npm
let ca = process.env.npm_config_ca;
if (ca)
console.log('Using npmconf ca.');
if (!ca && process.env.npm_config_cafile) {
try {
ca = fs.readFileSync(process.env.npm_config_cafile, { encoding: 'utf8' });
} catch (e) {
console.error('Could not read cafile', process.env.npm_config_cafile, e);
}
console.log('Using npmconf cafile.');
}
options.httpsAgent = new ProxyAgent({
rejectUnauthorized: !!process.env.npm_config_strict_ssl,
ca: ca
});
options.proxy = false;
} else {
const { getProxyForUrl } = require("proxy-from-env");
const proxyUrl = getProxyForUrl(downloadPath);
if (proxyUrl) {
const proxyUrlParts = new URL(proxyUrl);
if (proxyUrlParts.hostname && proxyUrlParts.protocol)
options.proxy = {
host: proxyUrlParts.hostname,
port: proxyUrlParts.port ? parseInt(proxyUrlParts.port) : 80,
protocol: proxyUrlParts.protocol
};
}
}
// Use specific User-Agent
if (process.env.npm_config_user_agent) {
options.headers = { 'User-Agent': process.env.npm_config_user_agent };
}
return options;
}
/**
* @param {string} cdnUrl
* @param {string} legacyCdnUrl
* @param {number} [majorVersion]
* @returns {Promise<string>}
*/
async getChromeDriverVersion(cdnUrl, legacyCdnUrl, majorVersion) {
if (majorVersion == null || majorVersion > 114) {
console.log('Finding Chromedriver version.');
let chromedriverVersion;
if (majorVersion) {
const requestOptions = this.getRequestOptions(`${cdnUrl}/chrome-for-testing/latest-versions-per-milestone.json`);
const response = await axios.request(requestOptions);
chromedriverVersion = response.data?.milestones[majorVersion.toString()]?.version;
} else {
const requestOptions = this.getRequestOptions(`${cdnUrl}/chrome-for-testing/last-known-good-versions.json`);
const response = await axios.request(requestOptions);
chromedriverVersion = response.data?.channels?.Stable?.version;
}
console.log(`Chromedriver version is ${chromedriverVersion}.`);
return chromedriverVersion;
} else {
console.log('Finding Chromedriver version using legacy method.');
const urlPath = majorVersion ? `LATEST_RELEASE_${majorVersion}` : 'LATEST_RELEASE';
const requestOptions = this.getRequestOptions(`${legacyCdnUrl}/${urlPath}`);
const response = await axios.request(requestOptions);
const chromedriverVersion = response.data.trim();
console.log(`Chromedriver version is ${chromedriverVersion}.`);
return chromedriverVersion;
}
}
/**
* @param {string} cdnUrl
* @param {string} version
* @param {string} platform
* @returns {Promise<[string]>}
*/
async getDownloadUrl(cdnUrl, version, platform) {
const getUrlUrl = `${cdnUrl}/chrome-for-testing/${version}.json`;
const requestOptions = this.getRequestOptions(getUrlUrl);
const response = await axios.request(requestOptions);
const url = response.data?.downloads?.chromedriver?.find((/** @type {{ platform: string; }} */ c) => c.platform == platform)?.url;
return url;
}
/**
*
* @param {import('axios').AxiosRequestConfig} requestOptions
* @param {string} filePath
*/
async requestBinary(requestOptions, filePath) {
const outFile = fs.createWriteStream(filePath);
let response;
try {
response = await axios.request({ responseType: 'stream', ...requestOptions });
} catch (error) {
let errorData = '';
if (error && error.response) {
if (error.response.status)
console.error('Error status code:', error.response.status);
if (error.response.data) {
error.response.data.on('data', data => errorData += data.toString('utf8'));
try {
await finishedAsync(error.response.data);
} catch (error) {
console.error('Error downloading entire response:', error);
}
}
}
console.error(`Error with http(s) request:\n${error}\nError data:\n${errorData}`);
process.exit(1);
}
let count = 0;
let notifiedCount = 0;
response.data.on('data', data => {
count += data.length;
if ((count - notifiedCount) > 1024 * 1024) {
console.log('Received ' + Math.floor(count / 1024) + 'K...');
notifiedCount = count;
}
});
response.data.on('end', () => console.log('Received ' + Math.floor(count / 1024) + 'K total.'));
const pipe = response.data.pipe(outFile);
await new Promise((resolve, reject) => {
pipe.on('finish', resolve);
pipe.on('error', reject);
});
}
/**
* @param {string} dirToExtractTo
* @param {string} chromedriverBinaryFilePath
* @param {string} downloadedFile
*/
async extractDownload(dirToExtractTo, chromedriverBinaryFilePath, downloadedFile) {
if (path.extname(downloadedFile) !== '.zip') {
fs.mkdirSync(path.dirname(chromedriverBinaryFilePath), { recursive: true });
fs.copyFileSync(downloadedFile, chromedriverBinaryFilePath);
console.log('Skipping zip extraction - binary file found.');
return;
}
console.log(`Extracting zip contents to ${dirToExtractTo}.`);
try {
await extractZip(path.resolve(downloadedFile), { dir: dirToExtractTo });
} catch (error) {
console.error('Error extracting archive: ' + error);
process.exit(1);
}
}
/**
* @param {string} originPath
* @param {string} targetPath
*/
async copyIntoPlace(originPath, targetPath) {
fs.rmSync(targetPath, { recursive: true, force: true });
console.log(`Copying from ${originPath} to target path ${targetPath}`);
fs.mkdirSync(targetPath);
// Look for the extracted directory, so we can rename it.
const files = fs.readdirSync(originPath, { withFileTypes: true })
.filter(dirent => dirent.isFile() && dirent.name.startsWith('chromedriver') && !dirent.name.endsWith(".debug") && !dirent.name.endsWith(".zip"))
.map(dirent => dirent.name);
const promises = files.map(name => {
return /** @type {Promise<void>} */(new Promise((resolve) => {
const file = path.join(originPath, name);
const reader = fs.createReadStream(file);
const targetFile = path.join(targetPath, name);
const writer = fs.createWriteStream(targetFile);
writer.on("close", () => resolve());
reader.pipe(writer);
}));
});
await Promise.all(promises);
}
fixFilePermissions() {
// Check that the binary is user-executable and fix it if it isn't (problems with unzip library)
if (process.platform != 'win32') {
const stat = fs.statSync(helper.path);
// 64 == 0100 (no octal literal in strict mode)
if (!(stat.mode & 64)) {
console.log('Fixing file permissions.');
fs.chmodSync(helper.path, '755');
}
}
}
/**
* @param {string} chromedriverVersion
*/
getMacOsRealArch(chromedriverVersion) {
if (process.arch === 'arm64' || this.isEmulatedRosettaEnvironment()) {
return compareVersions(chromedriverVersion, '106.0.5249.61') < 0
? 'mac64_m1'
: compareVersions(chromedriverVersion, '115') < 0 ? 'mac_arm64' : 'mac-arm64';
}
if (process.arch === 'x64') {
return compareVersions(chromedriverVersion, '115') < 0 ? 'mac64' : 'mac-x64';
}
return null;
}
isEmulatedRosettaEnvironment() {
const archName = child_process.spawnSync('uname', ['-m']).stdout.toString().trim();
if (archName === 'x86_64') {
const proc = child_process.spawnSync('sysctl', ['-in', 'sysctl.proc_translated']);
// When run with `-in`, the return code is 0 even if there is no `sysctl.proc_translated`
if (proc.status) {
console.error('Unexpected return code from sysctl: ' + proc.status);
process.exit(1);
}
// If there is no `sysctl.proc_translated` (i.e. not rosetta) then nothing is printed to
// stdout
if (!proc.stdout) {
return false;
}
const processTranslated = proc.stdout.toString().trim();
return processTranslated === '1';
}
return false;
}
}
function Deferred() {
this.resolve = null;
this.reject = null;
this.promise = new Promise(function (resolve, reject) {
this.resolve = resolve;
this.reject = reject;
}.bind(this));
Object.freeze(this);
}
if (require.main === module)
new Installer().install();
else if (process.env.NODE_ENV === 'test')
module.exports = Installer;
const fs = require('node:fs');
const path = require('node:path');
const tcpPortUsed = require('tcp-port-used');
function getPortFromArgs(args) {
let port = 9515;
if (!args)
return port;
const portRegexp = /--port=(\d*)/;
const portArg = args.find(function (arg) {
return portRegexp.test(arg);
});
if (portArg)
port = parseInt(portRegexp.exec(portArg)[1]);
return port;
}
process.env.PATH = path.join(__dirname, 'chromedriver') + path.delimiter + process.env.PATH;
const crpath = process.platform === 'win32' ? path.join(__dirname, 'chromedriver', 'chromedriver.exe') : path.join(__dirname, 'chromedriver', 'chromedriver');
const version = '125.0.6422.141';
let defaultInstance = null;
function start(args, returnPromise) {
let command = crpath;
if (!fs.existsSync(command)) {
console.log('Could not find chromedriver in default path: ', command);
console.log('Falling back to use global chromedriver bin');
command = process.platform === 'win32' ? 'chromedriver.exe' : 'chromedriver';
}
const cp = require('child_process').spawn(command, args);
cp.stdout.pipe(process.stdout);
cp.stderr.pipe(process.stderr);
defaultInstance = cp;
if (!returnPromise)
return cp;
const port = getPortFromArgs(args);
const pollInterval = 100;
const timeout = 10000;
return tcpPortUsed.waitUntilUsed(port, pollInterval, timeout)
.then(function () {
return cp;
});
}
function stop() {
if (defaultInstance != null)
defaultInstance.kill();
defaultInstance = null;
}
module.exports = {
path: crpath,
version,
start,
stop,
get defaultInstance() {
return defaultInstance;
}
};
{
"name": "chromedriver",
"version": "125.0.3",
"keywords": [
"chromedriver",
"selenium"
],
"description": "ChromeDriver for Selenium",
"homepage": "https://github.com/giggio/node-chromedriver",
"repository": {
"type": "git",
"url": "git://github.com/giggio/node-chromedriver.git"
},
"license": "Apache-2.0",
"author": {
"name": "Giovanni Bassi",
"email": "[email protected]",
"url": "http://www.lambda3.com.br"
},
"main": "lib/chromedriver",
"bin": {
"chromedriver": "bin/chromedriver"
},
"scripts": {
"install": "node install.js",
"update-chromedriver": "node update.js",
"typecheck": "tsc",
"test": "jest",
"test:ci": "jest --ci --reporters=default --reporters=jest-junit",
"lint": "eslint"
},
"dependencies": {
"@testim/chrome-version": "^1.1.4",
"axios": "^1.6.7",
"compare-versions": "^6.1.0",
"extract-zip": "^2.0.1",
"proxy-agent": "^6.4.0",
"proxy-from-env": "^1.1.0",
"tcp-port-used": "^1.0.2"
},
"devDependencies": {
"@types/jest": "^29.5.12",
"eslint": "^8.56.0",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"semver": "^7.6.0",
"typescript": "^5.3.3"
},
"engines": {
"node": ">=18"
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment