Integrations

< Back to Integrations

Playwright Proxy Integration with Bright Data

Playwright is a Node.js library to automate Chromium, Firefox and WebKit with a single API

Bright Data Super Proxy and Playwright Integration

  • Begin by going to your Bright Data Dashboard and clicking 'create a Zone'.
  • Choose 'Network type' and click save.
  • Within Playwright fill in the 'Proxy IP:Port' in the 'server' value, for examplehttp://zproxy.lum-superproxy.io:22225.
  • Under 'username' input your Bright Data account ID and proxy Zone name, for example:lum-customer-CUSTOMER-zone-YOURZONE and under 'password' put your Zone password found in the Zone settings.
  • For example:

const playwright = require('playwright');

(async () => {
    for (const browserType of ['chromium', 'firefox', 'webkit']) {
        const browser = await playwright[browserType].launch({
            headless: false,
            proxy: {
                server: 'http://zproxy.lum-superproxy.io:22225',
                username: 'lum-customer-USERNAME-zone-YOURZONE',
                password: 'PASSWORD'
            },
        });
        const context = await browser.newContext();
        const page = await context.newPage();
        await page.goto('http://lumtest.com/myip.json');
        await page.screenshot({ path: 'example.png' });
        await browser.close();
    }
})();

Proxy Manager and Playwright Integration

  • Create a Zone with the network, IP type and number of IPs you wish to use.
  • Install the Proxy Manager.
  • Click 'add new proxy' and choose the Zone and settings you require, click 'save'.
  • In Playwright under the 'server' input your local IP and Proxy Manager port (i.e. 127.0.0.1:24000)
    • The local host IP is 127.0.0.1
    • The port created in the Proxy Manager is 24XXX, for example 24000
  • Leave the username and password values empty, as the Bright Data Proxy Manager has already been authenticated with the Super Proxy.
  • For example:
const playwright = require('playwright');

(async () => {
    for (const browserType of ['chromium', 'firefox', 'webkit']) {
        const browser = await playwright[browserType].launch({
            headless: false,
            proxy: {
                server: '127.0.0.1:24000',
                username: '',
                password: ''
            },
        });
        const context = await browser.newContext();
        const page = await context.newPage();
        await page.goto('http://lumtest.com/myip.json');
        await page.screenshot({ path: 'example.png' });
        await browser.close();
    }
})();