Use proxies with Playwright

Learn how to set up resident and mobile proxies for test automation with Playwright.
Choose Plan 3 day trial • No set-up costs • Cancel anytime
Pricing
Playwright
  1. To use Playwright and set up your proxies you need to paste this code example
     const playwright = require('@playwright/test');
     const launchOptions = {
         proxy: {
             server: 'proxy.froxy.com:9000',
             username: 'login',
             password: 'password'
         }
     };
     (async () => {
         const defaultBrowser = await playwright['chromium'].launch({});
         const context = await defaultBrowser.newContext();
         const page = await context.newPage();
         await page.goto('https://froxy.com/api/detect-ip');
         console.log('chromium without proxy:', await page.textContent("*"));
         await defaultBrowser.close();
    
         for (const browserType of ['chromium', 'firefox', 'webkit']) {
             const browser = await playwright[browserType].launch(launchOptions);
             const context = await browser.newContext();
             const page = await context.newPage();
             try {
                 await page.goto('https://froxy.com/api/detect-ip');
                 console.log(`${browserType} with proxy:`, await page.textContent("*"));
             } catch (e) {
                 console.log(e);
             }
             await browser.close();
         }
     })();
    
  2. Please, add proxy config in playwright.config.ts use section
  3. You can get all information concerning server/port, login and password in your Froxy Dashboard
For additional info you can visit Playwright development portal.

Try Froxy Right Now

Proxies from Froxy fit most popular tools that allow you to achieve your goals!

Try a proxy right now, just create an account, choose a rate and get started.

Start now