Skip to content

Instantly share code, notes, and snippets.

@AnderRV

AnderRV/index.js Secret

Created August 29, 2021 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AnderRV/6d3e444a4e98ea4cdc3da0922a679b9f to your computer and use it in GitHub Desktop.
Save AnderRV/6d3e444a4e98ea4cdc3da0922a679b9f to your computer and use it in GitHub Desktop.
const playwright = require('playwright');
(async () => {
for (const browserType of ['chromium', 'firefox']) { // 'webkit' is also supported, but there is a problem on Linux
const browser = await playwright[browserType].launch();
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('https://httpbin.org/headers');
console.log(await page.locator('pre').textContent());
await browser.close();
}
})();
// "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/94.0.4595.0 Safari/537.36",
// "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment