Used to configure the Gatling browser protocol.
ProtocolBuilder browserProtocol = BrowserDsl
.gatlingBrowser()
// Optional setup block
.withLaunchOptions(new LaunchOptions().setHeadless(false))
.withContextOptions(new NewContextOptions().setViewportSize(1920, 1080).setIsMobile(true))
.enableUIMetrics()
.withDefaultTimeout(15000);
.withDefaultTimeout(millis) sets a default action/navigation timeout for every browser action — see
Timeouts for how it interacts with open/executeFlow.
// with a static value
BrowserDsl.browserAction("HomePage")
// with a dynamic value computed from a Gatling Expression Language String
BrowserDsl.browserAction("#{actionName}")
// a dynamic value computed from a function
BrowserDsl.browserAction(session -> session.getString("actionName"))
| Action | Description |
|---|---|
| Open | Navigate to a URL — tracked as a normal request |
| Flow | Run a scripted Playwright flow — tracked as a normal request |
| Browser Session Function | Manipulate the page without tracking it in reports |
| Clean Context | Clean up the Playwright BrowserContext |
See also: BrowserSession — the object passed into executeFlow/browserSessionFunction
callbacks — and Timeouts.