[[Google Chrome]]に限定した話になるが、`args`で[[--proxy-server]]や[[--proxy-bypass-list]]を指定すればよい。
```ts
const test = base.extend<{ targetPage: TargetPage }>({
targetPage: async ({ playwright }, use) => {
const browser = await playwright["chromium"].launch({
args: [
"--proxy-server=プロキシのURL:ポート番号",
"--proxy-bypass-list=プロキシを使わないホスト",
],
});
const context = await browser.newContext();
const page = await context.newPage();
const targetbloserPage = new TargetPage(page);
await page.setViewportSize({ width: 1920, height: 900 });
await page.goto("http://localhost:3000");
await use(targetbloserPage);
},
});
```
## 参考
- [How to use a proxy in Playwright | ScrapingAnt Blog](https://scrapingant.com/blog/how-to-use-a-proxy-in-playwright)