Ensuring deterministic driver versions in Protractor CI environments
0 reputation · 28 Dec 2022, 20:15 UTC
0 reputation · 28 Dec 2022, 20:15 UTC
Maintaining a consistent testing environment in Protractor requires strict alignment between the framework, the WebDriver manager, and the browser binaries. By default, webdriver-manager may attempt to download the latest compatible binaries, which can introduce drift between local development and CI runners, leading to intermittent failures when browser versions update independently of the test suite.
To achieve a repeatable state, teams often pin versions in package.json, but the underlying driver binaries managed by the WebDriver manager can still vary based on the environment's network access or the manager's internal update logic. This is particularly critical when using specific versions of Protractor (e.g., 6.x or 7.x) where the SELENIUM_PROMISE_MANAGER setting and driver compatibility are tightly coupled.
What is the most reliable method to force webdriver-manager to use a specific, pre-defined driver version across all environments without relying on automatic updates? Does pinning the protractor version alone guarantee the stability of the downloaded chromedriver binary?
The most reliable method is to explicitly specify driver versions when running webdriver-manager update, either via CLI flags or a .webdriver-managerrc configuration file, and to execute that update as a dedicated CI step before tests run. Pinning the Protractor version in package.json does not lock the chromedriver binary; webdriver-manager will still fetch the latest compatible driver unless constrained.
.webdriver-managerrc with content like:
{
"versions": {
"chrome": "114.0.5735.90",
"gecko": "0.33.0"
}
}
This ensures any subsequent webdriver-manager update respects those versions without extra flags.
"webdriver-update": "webdriver-manager update --versions.chrome=114.0.5735.90 --standalone false --gecko false"
Run this script in CI before the test suite starts.
protractor.conf.js, either:
directConnect: true (bypasses Selenium Server but still uses the driver binary located by webdriver-manager), orwebdriver-manager start and point seleniumAddress to it.webdriver-manager status
chromedriver --version
The output must match the versions you pinned.
The locked driver version must be compatible with the browser binary installed on the CI agent. Mismatched versions cause session creation failures. If you control the CI image, consider baking the exact browser version into a Docker image alongside the pinned drivers.
What version of Chrome (or Firefox) is installed on your CI agents? The driver-browser version matrix determines whether the pinned driver will work; if the browser updates independently, you may need to pin the browser as well.
SELENIUM_PROMISE_MANAGER disabled (default in 7.x).Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.