Socket
Socket
Sign inDemoInstall

chromedriver

Package Overview
Dependencies
Maintainers
1
Versions
216
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chromedriver - npm Package Compare versions

Comparing version 2.43.0 to 2.43.1

11

install.js

@@ -13,2 +13,8 @@ 'use strict';

var skipDownload = process.env.npm_config_chromedriver_skip_download || process.env.CHROMEDRIVER_SKIP_DOWNLOAD;
if (skipDownload) {
console.log('Found CHROMEDRIVER_SKIP_DOWNLOAD variable, skipping installation.')
return;
}
var libPath = path.join(__dirname, 'lib', 'chromedriver');

@@ -68,2 +74,7 @@ var cdnUrl = process.env.npm_config_chromedriver_cdnurl || process.env.CHROMEDRIVER_CDNURL || 'https://chromedriver.storage.googleapis.com';

promise.then(function () {
if (path.extname(downloadedFile) !== '.zip') {
fs.copyFileSync(downloadedFile, path.join(tmpPath, 'chromedriver'));
console.log('Skipping zip extraction - binary file found.');
return true;
}
return extractDownload(downloadedFile, tmpPath);

@@ -70,0 +81,0 @@ })

37

lib/chromedriver.js

@@ -0,11 +1,42 @@

var fs = require('fs');
var path = require('path');
var tcpPortUsed = require('tcp-port-used');
function getPortFromArgs(args) {
var port = 9515;
if (!args){
return port;
}
var portRegexp = /--port=(\d*)/;
var 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.43';
exports.start = function(args) {
var cp = require('child_process').spawn(exports.path, args);
exports.start = function(args, returnPromise) {
var 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';
}
var cp = require('child_process').spawn(command, args);
cp.stdout.pipe(process.stdout);
cp.stderr.pipe(process.stderr);
exports.defaultInstance = cp;
return cp;
if (!returnPromise) {
return cp;
}
var port = getPortFromArgs(args);
var pollInterval = 100;
var timeout = 10000;
return tcpPortUsed.waitUntilUsed(port, pollInterval, timeout)
.then(function () {
return cp;
});
};

@@ -12,0 +43,0 @@ exports.stop = function () {

5

package.json
{
"name": "chromedriver",
"version": "2.43.0",
"version": "2.43.1",
"keywords": [

@@ -32,4 +32,5 @@ "chromedriver",

"mkdirp": "^0.5.1",
"request": "^2.87.0"
"request": "^2.87.0",
"tcp-port-used": "^1.0.0"
}
}

@@ -70,2 +70,8 @@ ChromeDriver

This variable can be used to set either a `.zip` file or the binary itself, eg:
```shell
CHROMEDRIVER_FILEPATH=/bin/chromedriver
```
## Custom download options

@@ -85,2 +91,24 @@

## 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

@@ -148,2 +176,14 @@ -------

```
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

@@ -150,0 +190,0 @@ executed as a callback at the end of your tests

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc