-
-
Save AnderRV/6d3e444a4e98ea4cdc3da0922a679b9f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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