Skip to content

playwrightvsundetected-chromedriver

Apache-2.0 729 20 64,435
26.8 million (month) Jan 23 2015 1.45.3(4 days ago)
9,279 5 988 GPL-3.0
Sep 04 2020 541.3 thousand (month) 3.5.5(5 months ago)

Playwright is a Node.js library that provides a high-level API to automate web browsers. It allows you to automate browser tasks such as generating screenshots, creating PDFs, and testing web pages by simulating user interactions. Playwright is similar to Puppeteer, but it supports more browsers and it also provide capabilities for automation of browser like Microsoft Edge and Safari.

Playwright is commonly used for web scraping, end-to-end testing, and browser automation.
Playwright is a spiritual successor to Puppeter and is available in more languages and has access to more browser types.

Undetected chromedriver is custom open source headless browser driver based on Selenium. It extends Selenium headless browsers to be more ressistant to fingeprinting and identification techniquest like: - Cloudflare - Datadome - Imperva And other similar WAF anti-bot systems.

Highlights


stealthseleniumheadless-browser

Example Use


const { chromium } = require('playwright');

(async () => {
    const browser = await chromium.launch();
    const context = await browser.newContext();
    const page = await context.newPage();
    await page.goto('https://www.example.com/form');

    // fill in the form
    await page.fill('input[name="name"]', 'John Doe');
    await page.fill('input[name="email"]', 'johndoe@example.com');
    await page.selectOption('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();
})();
# It works the same as Selenium just with a different import.
import undetected_chromedriver as uc
driver = uc.Chrome(headless=True, use_subprocess=False)
driver.get('https://nowsecure.nl')
driver.save_screenshot('screenshot.png')
driver.close()

Alternatives / Similar


Was this page helpful?