-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webdriver-manager deprecation ? #517
Comments
As alternatives you can use new library provided by selenium team - selenium - manager |
we have now a CVE-2023-28155 reporting a vulnerability on protractor. currently this is clearly shown on :
|
It sure looks like webdriver-manager is EOL along with PRotractor. See #524 -- unless 3rd party post-EOL support comes along, the answer to your question is no, the dependencies for webdriver-manager will not be updated. I guess you could always fork it to fix yourself? Or look into the alternative in the second comment here. |
If you have Protractor installed globally via npm on Windows 64-bit, you can use these steps %APPDATA%\npm\node_modules\protractor\node_modules\webdriver-manager\built\lib\binaries\chrome_xml.js
getLatestChromeDriverVersion() {
const path = require('path')
const fs = require('fs')
const lastKnownGoodVersionsWithDownloads_Url = 'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json';
return http_utils_1.requestBody(lastKnownGoodVersionsWithDownloads_Url).then(body => {
const latestVersion_Body = JSON.parse(body)['channels']['Stable']
const latestVersion = latestVersion_Body['version']
const latestVersion_Url = latestVersion_Body['downloads']['chromedriver'].find(obj => obj['platform'] == 'win32')['url']
const latestMajorVersion = latestVersion.split('.')[0]
const localVersion_FileName = fs.readdirSync(path.resolve(__dirname, '..', '..', '..', 'selenium'))
.find(f => f.startsWith(`chromedriver_${latestMajorVersion}`)) || ''
const localVersion = localVersion_FileName.slice(13, -4)
const localVersion_Url = latestVersion_Url.replace(latestVersion, localVersion)
const localMajorVersion = localVersion.split('.')[0]
if (latestMajorVersion == localMajorVersion) {
return Promise.resolve({
url: localVersion_Url,
version: localVersion,
})
} else {
return Promise.resolve({
url: latestVersion_Url,
version: latestVersion,
})
}
});
} %APPDATA%\npm\node_modules\protractor\node_modules\webdriver-manager\built\lib\cmds\update.js
if (fileName.indexOf('chromedriver_') != -1) {
fs.renameSync(path.resolve(outputDir, 'chromedriver-win32', binary.zipContentName()), mv)
} else {
fs.renameSync(path.resolve(outputDir, binary.zipContentName()), mv);
} Finally, do a |
Thanks @alexsch01, this worked for me after replacing |
For anyone who uses patch-package, this is a cross platform patch based on the above. (This assumes a non-global install) Put it in a file named
|
@DavidDudson Thanks, that worked! The other solution didnt work for me on mac eventhough I changed win32 to mac-x64. |
This reverts commit 7b4febf.
After making this patch, ChromeDriver updates to 118 (latest as of 2023-10-16), but then I get this error when I try to actually run a protractor test:
|
Hey @DavidDudson ! thanks for this! can you post the code changes you made without the patch output? Cheers! I am seeing issues if you set the version in the cli (instead of using latest) but I am trying to solve this now 🤞 |
- added firefox to the testing suite - partial fix based on angular/webdriver-manager#517 (comment) and patch-package (if you have chrome version that matches latest driver...) - chrome needs to run `--headless` ¯\_(-_-)_/¯
@DavidDudson this still does not work for me:
Probably because Node v14 is too old? Replacing Edit:
Adding a |
I also removed some of the unnecessary changes and spammy logging: --- a/node_modules/webdriver-manager/built/lib/binaries/chrome_xml.js
+++ b/node_modules/webdriver-manager/built/lib/binaries/chrome_xml.js
@@ -55,14 +55,55 @@ class ChromeXml extends config_source_1.XmlConfigSource {
return 'linux';
}
}
+
+ getPlatformForDownload() {
+ const os = require('os')
+ const arch = os.arch()
+
+ switch (os.platform()) {
+ case 'darwin':
+ return arch === 'x64'? 'mac-x64' : 'mac-arm64'
+ case 'win32':
+ return arch === 'x64'? 'win64' : 'win32'
+ default:
+ return 'linux64'
+ }
+ }
+
/**
* Gets the latest item from the XML.
*/
getLatestChromeDriverVersion() {
- const latestReleaseUrl = 'https://chromedriver.storage.googleapis.com/LATEST_RELEASE';
- return http_utils_1.requestBody(latestReleaseUrl).then(latestVersion => {
- return this.getSpecificChromeDriverVersion(latestVersion);
- });
+ const path = require('path')
+ const fs = require('fs')
+
+ const lastKnownGoodVersionsWithDownloads_Url = 'https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json';
+ return http_utils_1.requestBody(lastKnownGoodVersionsWithDownloads_Url).then(body => {
+ const latestVersion_Body = JSON.parse(body)['channels']['Stable']
+
+ const latestVersion = latestVersion_Body['version']
+ const platformForDownload = this.getPlatformForDownload()
+ const latestVersion_Url = latestVersion_Body['downloads']['chromedriver'].find(obj => obj['platform'] == platformForDownload)['url']
+ const latestMajorVersion = latestVersion.split('.')[0]
+
+ const localVersion_FileName = fs.readdirSync(path.resolve(__dirname, '..', '..', '..', 'selenium'))
+ .find(f => f.startsWith(`chromedriver_${latestMajorVersion}`)) || ''
+ const localVersion = localVersion_FileName.split('_').pop().replace(/\.exe$/, '')
+ const localVersion_Url = latestVersion_Url.replace(latestVersion, localVersion)
+ const localMajorVersion = localVersion.split('.')[0]
+
+ if (latestMajorVersion == localMajorVersion) {
+ return Promise.resolve({
+ url: localVersion_Url,
+ version: localVersion,
+ })
+ } else {
+ return Promise.resolve({
+ url: latestVersion_Url,
+ version: latestVersion,
+ })
+ }
+ });
}
/**
* Gets a specific item from the XML.
--- a/node_modules/webdriver-manager/built/lib/cmds/update.js
+++ b/node_modules/webdriver-manager/built/lib/cmds/update.js
@@ -207,6 +208,21 @@ function updateBinary(binary, outputDir, proxy, ignoreSSL) {
}
});
}
+
+function getPlatformForDownload() {
+ const os = require('os')
+ const arch = os.arch()
+
+ switch (os.platform()) {
+ case 'darwin':
+ return arch === 'x64'? 'mac-x64' : 'mac-arm64'
+ case 'win32':
+ return arch === 'x64'? 'win64' : 'win32'
+ default:
+ return 'linux64'
+ }
+}
+
function unzip(binary, outputDir, fileName) {
// remove the previously saved file and unzip it
let osType = config_1.Config.osType();
@@ -237,7 +258,11 @@ function unzip(binary, outputDir, fileName) {
child_process.spawnSync('tar', ['zxvf', path.resolve(outputDir, fileName), '-C', outputDir]);
}
// rename
+ if (fileName.indexOf('chromedriver_') != -1) {
+ fs.renameSync(path.resolve(outputDir, 'chromedriver-' + getPlatformForDownload(), binary.zipContentName()), mv)
+ } else {
fs.renameSync(path.resolve(outputDir, binary.zipContentName()), mv);
+ }
// set permissions
if (osType !== 'Windows_NT') {
logger.info(binary.name + ': setting permissions to 0755 for ' + mv); |
If someone is looking for the solution to the same problem mentioned by @JordanRieger on Ubuntu Linux, it is here: /usr/lib/node_modules/webdriver-manager/built/lib/binaries/chrome_xml.js getLatestChromeDriverVersion() {
/usr/lib/node_modules/webdriver-manager/built/lib/cmds/update.js
|
did nobody fork the webdriver-manager to make this fix? so we can install that one besides protractor? |
@jcompagner I had to rewrite all my tests using the new selenium-manager without protractor at all. Big hassle, but at least I don't have to manually patch stuff any more. |
As Protractor is going to EOL soon, how about webdriver-manager ?
Can webdrive-manager handover to protractor partner(herodevs) for further maintenance ?
The text was updated successfully, but these errors were encountered: