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

117
Views
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 answers
Answer question

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 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!