Skip to content

Instantly share code, notes, and snippets.

@nicoandmee
Created August 30, 2022 05:54
Show Gist options
  • Save nicoandmee/20eff35be2338010f5e2c52618d07106 to your computer and use it in GitHub Desktop.
Save nicoandmee/20eff35be2338010f5e2c52618d07106 to your computer and use it in GitHub Desktop.
// playwright-extra is a drop-in replacement for playwright,
// it augments the installed playwright with plugin functionality
import { chromium } from 'playwright-extra'
// Load the stealth plugin and use defaults (all tricks to hide playwright usage)
// Note: playwright-extra is compatible with most puppeteer-extra plugins
import StealthPlugin from 'puppeteer-extra-plugin-stealth'
// Add the plugin to playwright (any number of plugins can be added)
chromium.use(StealthPlugin())
// ...(the rest of the quickstart code example is the same)
chromium.launch({ headless: true }).then(async browser => {
const page = await browser.newPage()
console.log('Testing the stealth plugin..')
await page.goto('https://bot.sannysoft.com', { waitUntil: 'networkidle' })
await page.screenshot({ path: 'stealth.png', fullPage: true })
console.log('All done, check the screenshot. ✨')
await browser.close()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment