01Node.js
import { chromium } from "playwright";
const browser = await chromium.launch({
proxy: {
server: "http://gw.fullstackproxy.com:47631",
username: "USERNAME-country-de",
password: "PASSWORD",
},
});
const page = await browser.newPage();
await page.goto("https://api.ipify.org");
console.log(await page.textContent("body"));
await browser.close();02Python
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch(proxy={
"server": "http://gw.fullstackproxy.com:47631",
"username": "USERNAME-country-de",
"password": "PASSWORD",
})
page = browser.new_page()
page.goto("https://api.ipify.org")
print(page.text_content("body"))
browser.close()03One IP per context
Give each context its own proxy with its own session name. Cookies, storage and the exit IP then all belong to that context, so several identities can run in one browser.
const browser = await chromium.launch();
for (const name of ["a1", "b2", "c3"]) {
const context = await browser.newContext({
proxy: {
server: "http://gw.fullstackproxy.com:47631",
username: `USERNAME-country-us-session-${name}-lifetime-30`,
password: "PASSWORD",
},
});
const page = await context.newPage();
await page.goto("https://api.ipify.org");
console.log(name, await page.textContent("body"));
await context.close();
}
await browser.close();04Skip images and fonts
Routing lets you drop files you do not need before they cost you traffic:
await page.route("**/*", (route) =>
["image", "media", "font"].includes(route.request().resourceType())
? route.abort()
: route.continue()
);