So I have a test where if I click on a link, it will redirect a few times and then land on one of two pages. Depending on the page depends on a list of tests I should run.
I'm not sure how to implement this. Using the below code, it always seems to go to "else" even if it's "page1". Is there a better way to do this? I can also detect whats on the page but if it times out it just fails. I was also looking at waitforURL but I would need two and one will always fail. Thoughts?
await page.locator('#button').click(); await page.waitForTimeout(30000);
const url = await page.url(); if (if (url.indexOf('test.com/landing') == -1) ) { .... } else { .... }
This thread is trying to answer question "How to determine which page a test lands on after clicking a link that redirects a few times?"
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].