proxyapi. från Hugo & Friends AB
← All examples

04 / Playwright

Sticky browser flow

Keep the same exit through sign-in, CSRF checks, and a multi-step form.

You will build

Stable session identity throughout the test

SessionE2E
Playwright
const rawRunId = process.env.CI_RUN_ID ?? crypto.randomUUID();
const sessionId = `e2e${rawRunId.toLowerCase().replace(/[^a-z0-9]/g, "")}`.slice(0, 32);
const username = `${process.env.PROXYAPI_KEY}-session-${sessionId}-country-se`;

const browser = await chromium.launch({
  proxy: { server: "https://proxy.proxyapi.se:443", username, password: "" },
});

try {
  const context = await browser.newContext();
  const page = await context.newPage();
  await page.goto("https://your-app.example/sign-in");
  // Continue the authorised test flow in the same context.
} finally {
  await browser.close();
}

Before production

  • A sticky session is routing assistance, not a promise that an upstream IP can never disappear.
  • Only test systems and accounts you are authorised to use.