Browser Web Vitals

Capture browser Web Vitals through your chosen browser tool and let LoadStrike enforce the metric budgets as a normal run result.

Use this page when

Visual guide

Sequence diagram showing how a LoadStrike workflow moves from setup to report output.
This page fits into the same setup, run, correlate, and report flow as the rest of the public LoadStrike runtime.

Guide

Metrics

The helper accepts Largest Contentful Paint (LCP), Interaction to Next Paint (INP), Cumulative Layout Shift (CLS), First Contentful Paint (FCP), and Time to First Byte (TTFB) values when your browser collector provides them.

Budgets

Configure only the maximum values that matter for the page or journey. Any returned metric that exceeds its configured maximum fails the scenario. Metrics without a configured maximum are recorded by your callback but do not fail the LoadStrike scenario.

Browser Collection

Use the built-in Playwright and Selenium collector helpers when the journey already has a browser page or driver. The helpers read browser performance entries and normalize LCP, INP, CLS, FCP, and TTFB into LoadStrikeBrowserWebVitalsResult. Teams can still use Lighthouse, browser performance APIs, or an internal collector when they need a custom measurement source.

When To Add Load

Run Web Vitals as a single standalone scenario when you want a page-quality gate. Add WithLoadSimulations only when you intentionally want repeated browser checks during a performance test.

Reports And Comparison

The scenario outcome is visible in the same reports and portal views as other LoadStrike runs, which lets teams keep page-quality gates beside load, stress, and transaction tests.

Feature usage samples

Use this helper when your browser tooling measures page quality and LoadStrike should enforce the budgets beside your load and transaction tests.

If you run these examples locally, add a valid runner key before execution starts. Set it with WithRunnerKey("...") or the config key LoadStrike:RunnerKey.

Browser Web Vitals

using LoadStrike;
using Microsoft.Playwright;

var scenario = LoadStrikeBrowserWebVitals.CreateScenario(
    "homepage-web-vitals",
    new LoadStrikeBrowserWebVitalsOptions
    {
        Url = "https://example.com",
        MaxLargestContentfulPaintMs = 2500,
        MaxInteractionToNextPaintMs = 200,
        MaxCumulativeLayoutShift = 0.1,
        MaxFirstContentfulPaintMs = 1800,
        MaxTimeToFirstByteMs = 800
    },
    async context =>
    {
        var playwright = await Playwright.CreateAsync();
        try
        {
            await using var browser = await playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions
            {
                Headless = true
            });
            var page = await browser.NewPageAsync();
            await page.GotoAsync(context.Options.Url);
            return await LoadStrikeBrowserWebVitalsCollector.FromPlaywrightPageAsync(context.Options, page);
        }
        finally
        {
            playwright.Dispose();
        }
    });

_ = scenario;

Web Vitals budgets

Url

The page or browser journey target. It must be an absolute URL.

LargestContentfulPaintMs

Largest Contentful Paint budget. Use it to catch slow rendering of the main content.

InteractionToNextPaintMs

Interaction to Next Paint budget. Use it to catch slow interaction response on the tested journey.

CumulativeLayoutShift

Cumulative Layout Shift budget. Use it to catch visual instability.

FirstContentfulPaintMs

First Contentful Paint budget. Use it to catch slow initial rendering.

TimeToFirstByteMs

Time to First Byte budget. Use it to catch slow server or edge response before rendering begins.

Metric limits

Only configured maximums are enforced. A returned metric fails the scenario when it is higher than its configured maximum.

Use FromPlaywrightPageAsync or FromSeleniumDriver when the browser page or driver is available. Use FromPerformanceSnapshot when another browser tool already returns metric values.