webdriver-installer 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ### [1.1.1](https://github.com/joeyparrish/webdriver-installer/compare/v1.1.0...v1.1.1) (2022-02-03)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * Make Windows browser version queries more robust ([85f3b27](https://github.com/joeyparrish/webdriver-installer/commit/85f3b2796e06e1a0f2171b46beef73f6a0407ecb))
9
+
3
10
  ## [1.1.0](https://github.com/joeyparrish/webdriver-installer/compare/v1.0.1...v1.1.0) (2022-02-03)
4
11
 
5
12
 
package/chrome.js CHANGED
@@ -36,9 +36,7 @@ class ChromeWebDriverInstaller extends WebDriverInstallerBase {
36
36
  } else if (os.platform() == 'darwin') {
37
37
  return await InstallerUtils.getMacAppVersion('Google Chrome');
38
38
  } else if (os.platform() == 'win32') {
39
- return await InstallerUtils.getWindowsRegistryVersion(
40
- 'HKCU\\Software\\Google\\Chrome\\BLBeacon',
41
- 'version');
39
+ return await InstallerUtils.getWindowsExeVersion('chrome.exe');
42
40
  } else {
43
41
  throw new Error(`Unrecognized platform: ${os.platform()}`);
44
42
  }
package/edge.js CHANGED
@@ -36,8 +36,7 @@ class EdgeWebDriverInstaller extends WebDriverInstallerBase {
36
36
  } else if (os.platform() == 'darwin') {
37
37
  return await InstallerUtils.getMacAppVersion('Microsoft Edge');
38
38
  } else if (os.platform() == 'win32') {
39
- return await InstallerUtils.getWindowsExeVersion(
40
- 'C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe');
39
+ return await InstallerUtils.getWindowsExeVersion('msedge.exe');
41
40
  } else {
42
41
  throw new Error(`Unrecognized platform: ${os.platform()}`);
43
42
  }
package/firefox.js CHANGED
@@ -34,9 +34,7 @@ class FirefoxWebDriverInstaller extends WebDriverInstallerBase {
34
34
  } else if (os.platform() == 'darwin') {
35
35
  return await InstallerUtils.getMacAppVersion('Firefox');
36
36
  } else if (os.platform() == 'win32') {
37
- return await InstallerUtils.getWindowsRegistryVersion(
38
- 'HKLM\\Software\\Mozilla\\Mozilla Firefox',
39
- 'CurrentVersion')
37
+ return await InstallerUtils.getWindowsExeVersion('firefox.exe');
40
38
  } else {
41
39
  throw new Error(`Unrecognized platform: ${os.platform()}`);
42
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webdriver-installer",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Install the right WebDriver version for your local browsers, automatically.",
5
5
  "main": "main.js",
6
6
  "repository": {
package/utils.js CHANGED
@@ -22,6 +22,9 @@ const execFile = util.promisify(childProcess.execFile);
22
22
  const pipeline = util.promisify(stream.pipeline);
23
23
  const zipFromBuffer = util.promisify(yauzl.fromBuffer);
24
24
 
25
+ const WINDOWS_REGISTRY_APP_PATHS =
26
+ 'HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\App\ Paths\\';
27
+
25
28
  /**
26
29
  * A static utility class for driver installers to use for common operations.
27
30
  */
@@ -90,7 +93,12 @@ class InstallerUtils {
90
93
  return null;
91
94
  }
92
95
 
93
- const result = await regQuery(path, '64');
96
+ // Try the 64-bit registry first, then fall back to the 32-bit registry.
97
+ // Necessary values could be in either location.
98
+ let result = await regQuery(path, '64');
99
+ if (!result[path].exists || !result[path].values[key]) {
100
+ result = await regQuery(path, '32');
101
+ }
94
102
  if (!result[path].exists || !result[path].values[key]) {
95
103
  return null;
96
104
  }
@@ -125,9 +133,16 @@ class InstallerUtils {
125
133
  }
126
134
 
127
135
  if (!(await InstallerUtils.fileExists(path))) {
128
- // No such file. Avoid the need to parse "not found" errors from
129
- // powershell output.
130
- return null;
136
+ // No such file.
137
+ // If it's a relative path, ask the registry for a full one.
138
+ if (!path.includes('/') && !path.includes('\\')) {
139
+ path = await InstallerUtils.getWindowsRegistryVersion(
140
+ WINDOWS_REGISTRY_APP_PATHS + path,
141
+ '');
142
+ if (!path || !(await InstallerUtils.fileExists(path))) {
143
+ return null;
144
+ }
145
+ }
131
146
  }
132
147
 
133
148
  const result = await InstallerUtils.runCommand([