Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: fix chromedriver download URL (#24464)

Andrey Lushnikov4d38d84612e7
diff --git a/tests/installation/fixture-scripts/download-chromedriver.js b/tests/installation/fixture-scripts/download-chromedriver.js
index a696ffa91b..ee57b62a02 100644
--- a/tests/installation/fixture-scripts/download-chromedriver.js
+++ b/tests/installation/fixture-scripts/download-chromedriver.js
@@ -1,6 +1,7 @@
const playwright = require('playwright-core');
const { execSync } = require('child_process');
const path = require('path');
+const fs = require('fs');
(async () => {
const dir = process.argv[2];
@@ -10,13 +11,24 @@ const path = require('path');
console.log(`Found Chrome version ${version}`);
const [major] = version.split('.');
- const driverVersion = execSync(`curl https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${major} --silent`).toString('utf-8');
- console.log(`Found ChromeDriver version ${driverVersion}`);
+ const downloadsInfo = JSON.parse(execSync(`curl https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone-with-downloads.json --silent`).toString('utf-8'));
+
+ let currentPlatform = '';
+ if (process.platform === 'darwin')
+ currentPlatform = process.arch === 'arm64' ? 'mac-arm64' : 'mac-x64';
+ else if (process.platform === 'linux')
+ currentPlatform = 'linux64';
+ else
+ currentPlatform = 'win64';
+ const chromeDriverURL = downloadsInfo.milestones[major].downloads.chromedriver.find(({ platform, url }) => platform === currentPlatform).url;
+ console.log(`Found ChromeDriver download URL: ${chromeDriverURL}`);
const zip = path.join(dir, 'chromedriver.zip');
- execSync(`curl https://chromedriver.storage.googleapis.com/${driverVersion}/chromedriver_${process.platform === 'darwin' ? 'mac' : 'linux'}64.zip --output ${zip} --silent`);
+ execSync(`curl ${chromeDriverURL} --output ${zip} --silent`);
console.log(`Downloaded ${zip}`);
execSync(`unzip ${zip}`, { cwd: dir });
console.log(`Unzipped ${zip}`);
+
+ fs.renameSync(`chromedriver-${currentPlatform}`, `chromedriver`);
})();