Selenium UI Load Guide

Run browser-based UI workflows under controlled load by executing Selenium flows inside LoadStrike scenarios.

Integration Model

LoadStrike does not require a special Selenium adapter. Use LoadStrikeScenario and LoadStrikeStep to run Selenium WebDriver actions directly inside scenario run delegates.

Dependencies

Add the Selenium package for your language and install a compatible browser driver such as ChromeDriver or geckodriver before execution. Create the driver in WithInit when you want to reuse browser sessions, run page flows in steps, and close resources in WithClean or finally blocks.

Load Strategy

Use lower copy counts than protocol tests because each browser session is heavier than HTTP requests. KeepConstant and Inject simulations are typically used for sustained UI flow load.

Result Mapping

Map successful UI outcomes to LoadStrikeResponse.Ok and map assertion, element lookup, navigation, or timeout failures to LoadStrikeResponse.Fail with meaningful status codes such as UI_ASSERTION_FAILED or UI_TIMEOUT.

Reporting

UI scenario runs use the same report model as other scenarios: summary, step measurements, status code distribution, failures, and latency percentiles in HTML/CSV/TXT/Markdown outputs.

Cluster Execution

For distributed UI load, run scenarios on coordinator and agents with NATS cluster mode. Ensure container images include the browser, driver binaries, and required OS dependencies for headless Selenium execution.

Feature Usage Samples

How to use snippets for Selenium UI Load Guide.

Switch between C#, Java, Python, TypeScript, and JavaScript to see the native SDK shape for this sample.

Licensing note: every runnable sample requires a valid runner key via WithRunnerKey("...") or config key LoadStrike:RunnerKey.

Selenium UI Step

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;

var scenario = LoadStrikeScenario.Create("ui-login", async context =>
{
    var step = await LoadStrikeStep.Run<string>("login", context, () =>
    {
        var options = new ChromeOptions();
        options.AddArgument("--headless=new");

        using var driver = new ChromeDriver(options);
        driver.Navigate().GoToUrl("https://example.com/login");
        driver.FindElement(By.Id("email")).SendKeys("[email protected]");
        driver.FindElement(By.CssSelector("button[type='submit']")).Click();

        return Task.FromResult(LoadStrikeResponse.Ok<string>(statusCode: "200"));
    });

    return step.AsReply();
});

Pattern

Selenium + driver

Install Selenium and a browser driver that matches the browser you want to automate.

Create WebDriver

Create the driver in WithInit for reuse or inside the step when each iteration should own its browser lifecycle.

LoadStrikeStep

Run the UI journey inside a named step so the workflow is measured and reported as part of the scenario.

Always quit

Dispose the driver in WithClean or a finally block so browsers do not accumulate between iterations.