gatling-playwright-plugin

BrowserDsl ScalaAPI

Add the following import:

import io.gatling.custom.browser.Predef._

Browser Protocol

Used to configure the Gatling browser protocol.

val browserProtocol: Protocol = gatlingBrowser
    //// This part of setup block is optional
    .withContextOptions(new NewContextOptions().setViewportSize(1920, 1080))
    .withLaunchOptions(new LaunchOptions().setHeadless(false))
    .enableUIMetrics()
    .withDefaultTimeout(15000)
    ////

.withDefaultTimeout(millis) sets a default action/navigation timeout for every browser action — see Timeouts for how it interacts with open/executeFlow.

Action name

// with a static value
browserAction("HomePage")
// with a dynamic value computed from a Gatling Expression Language String
browserAction("#{actionName}")
// a dynamic value computed from a function
browserAction(session => session("actionName").as[String])

Actions

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.