route to the fruit API await page.RouteAsync("*/**/api/v1/fruits", async route => { var json = new[] { new { name = "Strawberry", id = 21 } }; // fulfill the route with the mock data await route.FulfillAsync(new() { Json = json }); }); // Go to the page await page.GotoAsync("https://demo.playwright.dev/api-mocking"); // Assert that the Strawberry fruit is visible await Expect(page.GetByTextAsync("Strawberry")).ToBeVisibleAsync();