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

71
Views
How to measure time from interaction until the browser has painted with Puppeteer?

I'm using Puppeteer to create a user flow. I'm trying to measure the time from click to the rendered result on the page. I want to measure the whole duration of the render pipeline with:

JavaScript > Style > Layout > Paint > Composite

I'm not navigating to another page on click or displaying another button, I'm only updating elements.

How can I detect the end of the render pipeline?

I tried many different approaches, such as waiting for a selector, MutationObserver, or listening on events, but nothing worked properly. I also tried to extract the important tasks from a page.tracing result, but that was too complicated, and I can't find an API to extract that.

I found articles like measuring paint time, where requestAnimationFrame is used to measure this. But, in my case, combined with Puppeteer requestAnimationFrame, it's always too late.

For example, here is the part of the Code where I'm measuring the time with requestAnimationFrame, but when I'm generating a tracing report over that time I can see that the logged time is much too long.

await page.evaluate(() => window.performance.mark('test_start'));

await page.click(selectorSort);
 
const measureFrame = await page.evaluate(() => new Promise((resolve) => {
    window.requestAnimationFrame(() => {
        setTimeout(() => {
            performance.mark('test_end')
            const measure = performance.measure('FrameTime', 'test_start', 'test_end');
            resolve(measure.duration);
        })
    })
}));

Is there an easy or easier way to measure that time, or can someone explain to me why it won't work or what might be the best approach to try?

about 4 years ago · Santiago Trujillo
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!