Using Smart Proxy Manager with Playwright

Note

Playwright requires Node.js and npm installed.

Setup the Smart Proxy Manager Headless Proxy as described in Using Headless Browsers with Zyte Smart Proxy Manager.

Installation

Download and install Playwright:

$ npm install playwright

Sample script

Here is a sample script you can use to test the integration of PLaywright with Smart Proxy Manager, once you have installed the Headless Proxy.

const playwright = require('playwright');

async function main() {
    var browserFirefox = await playwright.firefox.launch({
        proxy: {server: "localhost:3128"}
    });
    var url = "https://toscrape.com/"
    const page = await browserFirefox.newPage({ignoreHTTPSErrors: true});
    await page.goto(url);
    await page.screenshot({path: 'screenshot.png', fullPage: true});
    await browserFirefox.close();
};

main();