Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

211
Views
Output execution time for a Playwright step with AJAX payload

I am trying to dump out a few key measurements to console when my test runs, rather than getting them from the reporter output, but I can't see how to grab the time taken for the last step to execute. Here's a simplified version based on the docs for request.timing() but I don't think that what I'm doing is classed as a request:

const { test, expect } = require('@playwright/test');

test('ApplicationLoadTime', async ({ page }) => {

  // Wait for applications to load
  await page.waitForSelector('img[alt="Application"]');

  // Not working! - get time for step execution
  const [fir] = await Promise.all([
    page.click('text=Further information requested'),
    page.waitForSelector('img[alt="Application"]')
  ]);
  console.log(fir.timing());

});

The click on "Further information requested" causes the page to be modified based on an AJAX call in the background and the appearance of the Application img tells me it's finished. Is this possible or do I need to rely on the reports instead?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

fir is going to be undefined in your code as page.click() doesn't return anything. You need to wait for the request whose timing you're interested in, use page.waitForEvent('requestfinished') or waitForNavigation:

const { test, expect } = require('@playwright/test');

test('ApplicationLoadTime', async ({ page }) => {

  // Wait for applications to load
  await page.waitForSelector('img[alt="Application"]');

  const [fir] = await Promise.all([
    // Wait for the request
    page.waitForEvent('requestfinished', r => r.url() == '<url of interest>'),
    page.click('text=Further information requested'),
    page.waitForSelector('img[alt="Application"]')
  ]);
  console.log(fir.timing());

});
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!