playwright/examples/download-and-verify.js
Dmitry Gozman 0a9377e0a9 chore: prepare to npm publish (#148)
- setup .npmignore;
- index.js selecting a browser;
- minor package.json tweaks;
- example script which works against npm pack'ed module.
2019-12-05 11:29:16 -08:00

18 lines
575 B
JavaScript

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
(async () => {
const browserName = process.argv[2];
const playwright = require('playwright')(browserName);
console.log('downloading ' + browserName + '...');
const revisionInfo = await playwright.downloadBrowser();
console.log('downloaded to ' + revisionInfo.folderPath);
console.log('checking user agent...');
const browser = await playwright.launch();
const page = await browser.newPage();
console.log(await page.evaluate('navigator.userAgent'));
await browser.close();
})()