Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

73
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda