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

120
Visualizações
Check if a pressed BUTTON did a REDIRECT to a correct page with PLAYWRIGHT?

I'm writing a test with playwright and I'd like to know the most correct way to check if after a pression of a button, it emitted a redirect to the expected URL, in order to pass the test.

Any help is appreciated, thanks!

I've found this snippet:

const [request] = await Promise.all([
    // Waits for the next request with the specified url
    page.waitForRequest('*URL*'),
    // Triggers the request
    page.click('button'),
  ]);

but it get stucked because it first clicks on the button, the redirect happens but then it keeps waiting for the request anyway.

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

0

Will waitForNaviation() work for you?

const [response] = await Promise.all([
    // Waits for the main frame navigation and returns the main resource response 
    page.waitForNavigation({url: '*URL*'}),
    // Triggers the request
    page.click('button'),
]);
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