playwright-java
playwright-java copied to clipboard
feat(api): add launchOptions support to ConnectOptions
Add ability to pass LaunchOptions directly via ConnectOptions instead of manually constructing JSON headers.
The implementation automatically serializes launchOptions to the x-playwright-launch-options header when provided.
Motivation / Use case
When running the browser inside a container and connecting remotely (see Playwright docs: Remote connection with Docker), it’s currently cumbersome to specify the browser channel.
current:
connectOptions.headers.put("x-playwright-launch-options", "{\"channel\":\"msedge\"}");
which you have to discover first
Proposed API (Java)
browserType.connect("ws://localhost:3000/ws",
new BrowserType.ConnectOptions().setLaunchOptions(
new BrowserType.LaunchOptions().setChannel("msedge")));
@microsoft-github-policy-service agree