Integrations
Browser automation
Proxy setup for Playwright and Puppeteer.
Browsers take the proxy server and the credential as separate fields. The
username field is the full login string, including any _loc_<CODE> or
_sticky suffix. Use the HTTP endpoint, proxy.masklabs.io:8080;
authenticated SOCKS5 is not reliably supported by Chromium.
A browser reuses connections, so page loads share an exit IP until the
connection closes. For a flow that must stay on one IP, such as a login
followed by more pages, use _sticky. To get a new IP, open a new browser
context. See Rotating vs sticky sessions.
Playwright
npm install -D playwright
import { chromium } from 'playwright'
const browser = await chromium.launch({
proxy: {
server: 'http://proxy.masklabs.io:8080',
username: 'mlabs_a1f9c3_sticky',
password: '<PASSWORD>',
},
})
const page = await browser.newPage()
await page.goto('https://ipinfo.io/json')
proxy is also accepted per context, browser.newContext({ proxy }), so
different contexts can use different credentials or locations without
relaunching the browser.
Puppeteer
npm install puppeteer
import puppeteer from 'puppeteer'
const browser = await puppeteer.launch({
args: ['--proxy-server=proxy.masklabs.io:8080'],
})
const page = await browser.newPage()
await page.authenticate({
username: 'mlabs_a1f9c3_sticky',
password: '<PASSWORD>',
})
await page.goto('https://ipinfo.io/json')
The proxy server is set at launch; the credential is set per page with
page.authenticate.