playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Feature] Set private proxy in codegen

Open Vladislav875 opened this issue 2 years ago • 2 comments

Make it possible to use playwright codegen with the ability to connect private proxies (with login and password), now it is possible to connect only public proxies

An error occurs when trying to pass to the dict argument. When passing --proxy--username="username", an error is given that there is no such parameter (obviously) I have not found any other options for transmitting parameters for private proxies, the documentation also says only that you can connect them in the code, but codegen is not affected Screenshot_8

Vladislav875 avatar Jun 24 '22 14:06 Vladislav875

+1 for this

In our scenario it's very often that we need to automate a page which is from a different geo-location. Without proxy the page very often redirects to a local counterpart and we need to hack this one way or another every time. We have a pool of proxies from different continents for that purpose but they are all our own, authenticated, proxies so we cannot use them with npx playwright codegen :(

ipatalas avatar Jan 02 '23 14:01 ipatalas

+1 for this We also need it to build test scenarios for different geo-locations use-cases

gilgulim avatar May 24 '23 15:05 gilgulim

+1 also

dominik59 avatar Jul 24 '23 16:07 dominik59

We recommend launching "codegen with custom setup" for that: https://playwright.dev/docs/codegen#record-using-custom-setup

const { chromium } = require('@playwright/test');

(async () => {
  // Make sure to run headed.
  const browser = await chromium.launch({ headless: false });

  // Setup context however you like.
  const context = await browser.newContext({ /* pass any options */ });

  // Pause the page, and start recording manually.
  const page = await context.newPage();
  await page.pause();
})();

(this works across all the language bindings)

Closing by that!

mxschmitt avatar Nov 03 '23 13:11 mxschmitt