Skip to content

puppeteer-stealthvspuppeteer

MIT 286 29 87,572
1.9 million (month) May 29 2018 2.11.2(1 year, 2 months ago)
87,572 29 286 Apache-2.0
Mar 23 2013 17.3 million (month) 22.12.1(10 days ago)

Puppeteer Stealth is puppeteer plugin that fortifies headles browser for web scraping. This makes detection of puppeteer scrapers more difficult allowing to scrape targets which use headless browser detection techniques.

Puppeteer-stealth does this by applying various javascript patches to cover up traces of headless browser presence in the web scraping browser's environment.

Puppeteer is a Node.js library that provides a high-level API to control headless Chrome or Chromium over the DevTools Protocol. It allows you to automate browser tasks such as generating screenshots, creating PDFs, and testing web pages by simulating user interactions.

Puppeteer is commonly used for web scraping, end-to-end testing, and browser automation.

Puppeteer is one of the most popular browser automation toolkits though it's only available in NodeJS. It offers asynchronous API which enables easy asynchronous scaling.

Example Use


const puppeteer = require('puppeteer-extra')

// add stealth plugin and use defaults (all evasion techniques)
const StealthPlugin = require('puppeteer-extra-plugin-stealth')
puppeteer.use(StealthPlugin())

// puppeteer usage as normal
puppeteer.launch({ headless: true }).then(async browser => {
  console.log('Running tests..')
  const page = await browser.newPage()
  await page.goto('https://bot.sannysoft.com')
  await page.waitForTimeout(5000)
  await page.screenshot({ path: 'result.png', fullPage: true })
  await browser.close()
  console.log("success - check the result.png screenshot")
})
const puppeteer = require('puppeteer');

(async () => {
    const browser = await puppeteer.launch();
    const page = await browser.newPage();
    // go to pages
    await page.goto('https://www.example.com');
    // take a screenshot
    await page.screenshot({path: 'example.png'});
    // fill in the form
    await page.type('input[name="name"]', 'John Doe');
    await page.type('input[name="email"]', 'johndoe@example.com');
    await page.select('select[name="country"]', 'US');

    // submit the form
    await page.click('button[type="submit"]');

    // wait for the page to load after the form is submitted
    await page.waitForNavigation();

    // take a screenshot
    await page.screenshot({path: 'form-submission.png'});

    await browser.close();
})();

Alternatives / Similar


Was this page helpful?