-
-
Notifications
You must be signed in to change notification settings - Fork 217
Description
Expected Behavior
When specifying a version below v4 of Selenium the install task should download that older version of Selenium.
Current Behavior
Currently it generates the wrong URL and therefore resulting in a 404.
The issue is two things:
- The stripping of the patch version number when determining part of the path. It appears the default base URL used to be https://selenium-release.storage.googleapis.com while now it is https://github.com/SeleniumHQ/selenium/releases/download. The old base URL did strip the patch version number while the new base URL does not.
- The
selenium-prefix in that same path component is also now part of the location.
We can restore access to most of the selenium versions by replacing this line with:
: `selenium-${opts.seleniumVersion}`With this change there are still a handful of versions that cannot be downloaded (such as 3.150.0) but that is because those versions do not include a pre-built jar and therefore there is nothing we can do about that. If this change sounds good I can put together a quick PR.
Steps to Reproduce
Given this package.json:
{
"name": "ssa-test",
"private": true,
"type": "module",
"devDependencies": {
"selenium-standalone": "^8.0.11"
}
}And this usage of the install API:
#!/usr/bin/env node
import selenium from 'selenium-standalone'
;(async function() {
await selenium.install({ version: '3.141.0' })
})()I get this error:
Error in "getDownloadStream". Could not download https://github.com/SeleniumHQ/selenium/releases/download/3.141/selenium-server-standalone-3.141.0.jar
See more details below:
404 https://github.com/SeleniumHQ/selenium/releases/download/3.141/selenium-server-standalone-3.141.0.jar
Response code 404 (Not Found)
/home/me/tmp/ssa-test/node_modules/selenium-standalone/lib/install.js:318
throw new Error('Could not download ' + downloadUrl);
^
Error: Could not download https://github.com/SeleniumHQ/selenium/releases/download/3.141/selenium-server-standalone-3.141.0.jar
at Request.<anonymous> (/home/me/tmp/ssa-test/node_modules/selenium-standalone/lib/install.js:318:17)
at Object.onceWrapper (node:events:642:26)
at Request.emit (node:events:527:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Node.js v18.0.0
Logs
I wasn't sure which versions of selenium could and could not be downloaded. So I put together a quick script to use this libaries functions to generate the URL and then do a test HEAD request. The below is that script:
#!/usr/bin/env node
// Prints all versions of selenium which selenium-standalone cannot compute
// a valid selenium version URL.
import computeDownloadUrls from 'selenium-standalone/lib/compute-download-urls.js'
import defaultConfig from 'selenium-standalone/lib/default-config.js'
import got from 'got'
const defaults = defaultConfig()
const versions = [
'2.53.1', '2.53.0', '2.52.2', '2.52.1', '2.52.0', '2.51.0', '2.50.1',
'2.50.0', '2.49.1', '2.49.0', '2.48.2', '2.48.1', '2.48.0', '2.47.1',
'2.47.0', '2.46.0', '2.45.0', '2.44.0', '2.43.1', '2.43.0', '2.42.2',
'2.42.1', '2.42.0', '2.41.0', '2.40.0', '2.39.0', '3.0.0-beta-1',
'3.0.0-beta-2', '3.0.0-beta-3', '3.0.0-beta-4', '3.0.0', '3.0.1', '3.1.0',
'3.2.0', '3.3.0', '3.3.1', '3.4.0', '3.5.0', '3.5.1', '3.5.2', '3.5.3',
'3.6.0', '3.7.0', '3.7.1', '3.8.0', '3.8.1', '3.9.0', '3.9.1', '3.10.0',
'3.11.0', '3.12.0', '3.13.0', '3.14.0', '3.141.0', '3.141.5', '3.141.59',
'3.150.0', '4.0.0-alpha-1', '4.0.0-alpha-2', '4.0.0-alpha-3', '4.0.0-alpha-4',
'4.0.0-alpha-5', '4.0.0-alpha-6', '4.0.0-alpha-7', '4.0.0-beta-1',
'4.0.0-beta-2', '4.0.0-beta-3', '4.0.0-beta-4', '4.0.0-rc-1', '4.0.0-rc-2',
'4.0.0-rc-3', '4.0.0', '4.1.0',
]
async function checkVersion(version) {
const urls = await computeDownloadUrls({
seleniumVersion: version,
seleniumBaseURL: defaults.baseURL,
drivers: {}
});
const { statusCode } = await got(
urls.selenium,
{ method: 'HEAD', throwHttpErrors: false }
)
return statusCode == 200
}
;(async function() {
Promise.all(versions.map(async version => {
if( !await checkVersion(version) ) console.log(version)
}))
})()Using the existing code only v4 versions of Selenium work. With my suggested change the only output is:
2.52.2
2.52.1
3.0.0-beta-1
3.0.0-beta-2
3.0.0-beta-3
3.0.0-beta-4
3.150.0
Those versions are failing because there is not pre-built jar file so nothing we can do about that. It might be worth considering incorporating a version of this script into the repo to run occasionally to verify the URLs. We could ignore the versions we know that will fail and also maybe verify the URLs for the web drivers.
Your Environment
- Version of
selenium-standalonethat you are using: 8.0.11 - Is there another tool calling
selenium-standaloneon your behalf: Hit the issue while working with PouchDB but my reproduction case shows it is independent of that tool. - System/platform: Linux (PopOS)