MarketSquare / MarketSquare/robotframework-browser
Expose remote-connection options on `Connect To Browser` (`slowMo`, `headers`, `exposeNetwork`, `isLocal`, `noDefaults`) and `host=` on `Launch Browser Server`
@Snooz82 is already working on this.
Since Aug 6, 2026.
- Dominant language
- Python
- Stars
- 655
- Forks
- 147
- Avg merge
- 5h 27m
- Merged PRs (30d)
- 59
Description
## Use case
`Connect To Browser` and `Launch Browser Server` exist precisely for remote-grid and attach-to-real-Chrome setups, but they currently forward almost none of Playwright's connection options. Real deployments hit these gaps quickly, with no workaround inside the library:
- **`headers=`** — remote browser providers (Selenium-grid-style services, cloud browser farms) authenticate the WebSocket connection with an `Authorization` or API-key header. Without it, connecting to such services is impossible.
- **`exposeNetwork=`** — when the browser runs remotely but the app under test runs on the tester's machine (`localhost:3000`), the remote browser cannot reach it. `exposeNetwork` tunnels chosen hosts through the client, e.g. ``.
- **`slowMo=`** — `New Browser` already offers `slowMo` for debugging; connected browsers should be debuggable the same way.
- **`isLocal=`** — tells Playwright the server is on the same machine, so downloads/videos/traces use local paths instead of streaming.
- **`noDefaults=`** (CDP) — when attaching to a user's daily-driver Chrome over CDP, Playwright's default automation tweaks are unwanted; `noDefaults` connects without them.
- **`host=` on `Launch Browser Server`** — the server currently binds to localhost only; `host=0.0.0.0` is required to accept connections from another machine or container, which is the main reason to run a browser server at all. `port` and `wsPath` are already forwarded, making the missing `host` an odd gap.
## Proposed keyword / arguments
All new arguments named-only with `None` defaults (option not sent unless given):
- `Connect To Browser wsEndpoint browser=chromium use_cdp=False *, timeout=... slowMo=None headers=None exposeNetwork=None isLocal=None noDefaults=None`
- `slowMo`, `headers` apply to both `connect` and `connectOverCDP`; `exposeNetwork`, `isLocal` only to `connect`; `noDefaults` only to `connectOverCDP` — invalid combinations produce a clear error.
- `Launch Browser Server browser=chromium headless=True *, ... host=None port=None wsPath=None ...`
```robotframework
*** Test Cases ***
Connect To Cloud Browser Grid
${headers}= Create Dictionary Authorization=Bearer ${API_TOKEN}
Connect To Browser wss://grid.example.com/playwright chromium
... headers=${headers} exposeNetwork=
New Page http://localhost:3000
Get Text h1 == My Local App
Serve Browser Across Containers
${ws}= Launch Browser Server chromium headless=True host=0.0.0.0 port=9222
Attach To Real Chrome Without Automation Defaults
Connect To Browser http://localhost:9222 chromium use_cdp=True noDefaults=True
```
## Playwright API
- [browserType.connect](https://playwright.dev/docs/api/class-browsertype#browser-type-connect) — `slowMo`, `headers`, `exposeNetwork` options
- [browserType.connectOverCDP](https://playwright.dev/docs/api/class-browsertype#browser-type-connect-over-cdp) — `slowMo`, `headers`, `noDefaults` options
- [browserType.launchServer](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-server) — `host` option
## Implementation notes
- `protobuf/playwright.proto`: extend the `ConnectToBrowser` request with the new fields; add `host` to the launch-server request.
- `node/playwright-wrapper` (playwright-state connect handler): route options to the correct `connect`/`connectOverCDP` call; `isLocal` note — verify option availability in pinned Playwright 1.62 wording before wiring.
- `Browser/keywords/playwright_state.py`: new named-only args on `connect_to_browser` and `launch_browser_server`; document which options apply to CDP vs. WebSocket connections.
- atest: `Launch Browser Server` + `Connect To Browser` round trips with `slowMo`/`headers` (the existing browser-server tests can be extended).
## Backwards compatibility
All additions are named-only arguments defaulting to `None`, in which case no option is passed and Playwright's current defaults apply — existing connect/launch calls behave identically.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.