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

143
Visualizações
Waiting for ID to change on component using Puppeteer

I have a table component that has pagination. I've added a data attribute on the <tbody> tag that changes when clicking the table page next button (e.g. data-id: table-page-one changes to data-id: table-page-two. I need to wait for this ID to chance before checking the row elements. The test is passing if I run it with SLOMO=true HEADLESS=false, but when I run it normally, after the pagination click, It gives the following error: thrown: Exceeded timeout of 20000 ms for a test. My code is similar to the follow:

if ('verify table row checkboxes are checked', async () => {
  await page.click(nextTablePageSelector);

  // gets stuck here
  await page. waitForSelector("[data-id='table-page-two']");

  // below works in SLOMO=true HEADLESS=false mode
  // checking each row using $$eval
}); 

I've with a custom delay method between the page.click and page.waitForSelector and it works, but the team doesn't want to uses delays, because it can lead to flakey tests.

What is the proper way to watch for part of the UI changing, or more specifically, watching for an attribute that you're already used to change?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Consider grouping the promises and using the visible flag.

await Promise.all([
  page.click(nextTablePageSelector),
  page.waitForSelector('tbody[data-id=page-two]', { visible: true }),
])
about 4 years ago · Juan Pablo Isaza Relatório
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