Skip to content

Instantly share code, notes, and snippets.

@pganti
Forked from ebidel/download_chrome41.js
Created May 6, 2019 22:06
Show Gist options
  • Save pganti/14f0bad78d7430bfbd3e102df66d4f4d to your computer and use it in GitHub Desktop.
Save pganti/14f0bad78d7430bfbd3e102df66d4f4d to your computer and use it in GitHub Desktop.
For when you need to test your site in Google Search (Chrome 41).
/**
* Copyright 2018 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @author ebidel@ (Eric Bidelman)
*/
const puppeteer = require('puppeteer');
const LAST_CHROME41_REVISION = '310958';
(async() => {
const browserFetcher = puppeteer.createBrowserFetcher();
const canDownload = await browserFetcher.canDownload(LAST_CHROME41_REVISION);
console.assert(canDownload, `Cannot download Chrome 41 ${LAST_CHROME41_REVISION}`);
const revisionInfo = await browserFetcher.download(LAST_CHROME41_REVISION, (bytes, total) => {
console.log(`Downloaded ${bytes/total * 100}%`);
});
console.log('Local downloaded chromium revisions:', await browserFetcher.localRevisions());
console.log('Run it with:');
console.log(`${revisionInfo.executablePath} --user-data-dir=./chrome41profile`);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment