chromedriver 147.0.1 → 147.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/install.js CHANGED
@@ -235,7 +235,7 @@ class Installer {
235
235
  fs.writeFileSync(testFile, 'test');
236
236
  fs.unlinkSync(testFile);
237
237
  return candidatePath;
238
- } catch (e) {
238
+ } catch (/** @type {any} */e) {
239
239
  console.log(candidatePath, 'is not writable:', e.message);
240
240
  }
241
241
  }
@@ -346,7 +346,7 @@ class Installer {
346
346
  let response;
347
347
  try {
348
348
  response = await axios.request({ responseType: 'stream', ...requestOptions });
349
- } catch (error) {
349
+ } catch (/** @type {any} */ error) {
350
350
  let errorData = '';
351
351
  if (error && error.response) {
352
352
  if (error.response.status)
@@ -1,48 +1,63 @@
1
- const fs = require('node:fs');
2
- const path = require('node:path');
3
- const tcpPortUsed = require('tcp-port-used');
1
+ const fs = require("node:fs");
2
+ const path = require("node:path");
3
+ const tcpPortUsed = require("tcp-port-used");
4
4
  function getPortFromArgs(args) {
5
- let port = 9515;
6
- if (!args)
7
- return port;
8
- const portRegexp = /--port=(\d*)/;
5
+ if (!args || args.length === 0) return;
6
+ const portRegexp = /--port=(\d+)/;
9
7
  const portArg = args.find(function (arg) {
10
8
  return portRegexp.test(arg);
11
9
  });
12
- if (portArg)
13
- port = parseInt(portRegexp.exec(portArg)[1]);
10
+ if (!portArg) {
11
+ const catchAllPortRegexp = /--port=(\S+)/;
12
+ const incorrectTypePortArg = args.find(function (arg) {
13
+ return catchAllPortRegexp.test(arg);
14
+ });
15
+ if (incorrectTypePortArg) {
16
+ console.error("Invalid port.");
17
+ process.exit(1);
18
+ } else {
19
+ return;
20
+ }
21
+ }
22
+ // @ts-expect-error Regex already checked
23
+ const port = parseInt(portRegexp.exec(portArg)[1]);
14
24
  return port;
15
25
  }
16
- process.env.PATH = path.join(__dirname, 'chromedriver') + path.delimiter + process.env.PATH;
17
- const crpath = process.platform === 'win32' ? path.join(__dirname, 'chromedriver', 'chromedriver.exe') : path.join(__dirname, 'chromedriver', 'chromedriver');
18
- const version = '147.0.7727.50';
26
+ process.env.PATH = path.join(__dirname, "chromedriver") + path.delimiter + process.env.PATH;
27
+ const crpath =
28
+ process.platform === "win32"
29
+ ? path.join(__dirname, "chromedriver", "chromedriver.exe")
30
+ : path.join(__dirname, "chromedriver", "chromedriver");
31
+ const version = "147.0.7727.56";
19
32
  let defaultInstance = null;
20
33
 
21
34
  function start(args, returnPromise) {
35
+ args = args || [];
22
36
  let command = crpath;
23
37
  if (!fs.existsSync(command)) {
24
- console.log('Could not find chromedriver in default path: ', command);
25
- console.log('Falling back to use global chromedriver bin');
26
- command = process.platform === 'win32' ? 'chromedriver.exe' : 'chromedriver';
38
+ console.log("Could not find chromedriver in default path: ", command);
39
+ console.log("Falling back to use global chromedriver bin");
40
+ command = process.platform === "win32" ? "chromedriver.exe" : "chromedriver";
27
41
  }
28
- const cp = require('child_process').spawn(command, args);
42
+ let port = getPortFromArgs(args);
43
+ if (!port) {
44
+ args.push("--port=9515");
45
+ port = 9515;
46
+ }
47
+ const cp = require("child_process").spawn(command, args);
29
48
  cp.stdout.pipe(process.stdout);
30
49
  cp.stderr.pipe(process.stderr);
31
50
  defaultInstance = cp;
32
- if (!returnPromise)
33
- return cp;
34
- const port = getPortFromArgs(args);
51
+ if (!returnPromise) return cp;
35
52
  const pollInterval = 100;
36
53
  const timeout = 10000;
37
- return tcpPortUsed.waitUntilUsed(port, pollInterval, timeout)
38
- .then(function () {
39
- return cp;
40
- });
54
+ return tcpPortUsed.waitUntilUsed(port, pollInterval, timeout).then(function () {
55
+ return cp;
56
+ });
41
57
  }
42
58
 
43
59
  function stop() {
44
- if (defaultInstance != null)
45
- defaultInstance.kill();
60
+ if (defaultInstance != null) defaultInstance.kill();
46
61
  defaultInstance = null;
47
62
  }
48
63
 
@@ -53,5 +68,5 @@ module.exports = {
53
68
  stop,
54
69
  get defaultInstance() {
55
70
  return defaultInstance;
56
- }
71
+ },
57
72
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chromedriver",
3
- "version": "147.0.1",
3
+ "version": "147.0.3",
4
4
  "keywords": [
5
5
  "chromedriver",
6
6
  "selenium"
@@ -31,24 +31,28 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@testim/chrome-version": "^1.1.4",
34
- "axios": "^1.13.5",
34
+ "axios": "^1.15.0",
35
35
  "compare-versions": "^6.1.0",
36
36
  "extract-zip": "^2.0.1",
37
- "proxy-agent": "^6.5.0",
37
+ "proxy-agent": "^8.0.1",
38
38
  "proxy-from-env": "^2.0.0",
39
39
  "tcp-port-used": "^1.0.2"
40
40
  },
41
41
  "devDependencies": {
42
- "@eslint/eslintrc": "^3.3.4",
42
+ "@eslint/eslintrc": "^3.3.5",
43
43
  "@eslint/js": "^10.0.1",
44
+ "@types/axios": "^0.9.36",
44
45
  "@types/jest": "^30.0.0",
45
- "@types/node": "^25.3.2",
46
- "eslint": "^10.0.2",
47
- "globals": "^17.3.0",
48
- "jest": "^30.2.0",
46
+ "@types/node": "^25.6.0",
47
+ "@types/proxy-from-env": "^1.0.4",
48
+ "@types/semver": "^7.7.1",
49
+ "@types/tcp-port-used": "^1.0.4",
50
+ "eslint": "^10.2.0",
51
+ "globals": "^17.5.0",
52
+ "jest": "^30.3.0",
49
53
  "jest-junit": "^16.0.0",
50
54
  "semver": "^7.7.4",
51
- "typescript": "^5.9.3"
55
+ "typescript": "^6.0.2"
52
56
  },
53
57
  "engines": {
54
58
  "node": ">=20"