0

After navigating to a page, how can I get the response time of 10 APIs that would have been called? I want the time to be accurate as shown in the network tab- to test the performance sanity.

enter image description here

I have tried the playwright's offering https://playwright.dev/docs/api/class-request#request-timing but the response time given by playwright and network tab is different.

    const waitForResponseOfXXX = page.waitForResponse(
        '**/prism/?op=XXX'
    );

    await page.goto(
        'https://testing.com'
    );
    const xxxResponse = await waitForResponseOfXXX;

    let timings = await xxxResponse.request().timing();
    console.log(
        `xxxResponse:` +
            (timings.responseEnd - timings.responseStart)
    );

Ken White
  • 123,280
  • 14
  • 225
  • 444
IAmAnil
  • 1
  • 2

0 Answers0