Интеграция прокси с Playwright

Playwright has first-class proxy support, so there is no extension trick or separate authenticate call. Pass a proxy object with server, username and password to launch(), and it applies across Chromium, Firefox and WebKit. You can also set the proxy per context when different pages need different IPs.

run.jsjavascript
import { chromium } from "playwright";

const browser = await chromium.launch({
  proxy: {
    // Residential gateway, or "http://IP:PORT" for one of your ISP proxies.
    server: "http://gw-eu.murphyproxies.com:8888",
    username: "USERNAME",
    password: "PASSWORD",
  },
});

const page = await browser.newPage();
await page.goto("https://httpbin.org/ip");
console.log(await page.textContent("body"));

await browser.close();

// Per-context proxy (e.g. a US exit in one context, an ISP IP in another):
// const context = await browser.newContext({
//   proxy: { server: "http://gw-usa.murphyproxies.com:8888",
//            username: "USERNAME", password: "PASSWORD" },
// });

Настройка за 5 шагов

  1. 1Install the client with npm install playwright.
  2. 2Pass a proxy object (server, username, password) to chromium.launch().
  3. 3Point server at http://gw-eu.murphyproxies.com:8888 (another gw- region, port 7777 on Private 2, or http://IP:PORT for an ISP proxy) with the credentials from your dashboard.
  4. 4Open a page and navigate to an IP echo endpoint to verify the exit IP.
  5. 5Move the proxy onto newContext() when you need separate IPs across parallel work.

Вопросы о прокси для Playwright

Всё, что нужно, чтобы пустить Playwright через Murphy, от авторизации до ротации.

Получите доступы для Playwright

Выберите сеть под свою задачу. ISP-прокси для быстрых и стабильных сессий, резидентные, когда против жёстких антиботов нужно много разных IP.

Другие интеграции