← Back to Discord Forum

How to handle redirection?


Currently I am on a page, I submit a form, and wait for direction, but when I procceed it get the "playwright._impl._api_types.Error: Execution context was destroyed, most likely because of a navigation" error. So how I am handling this:

await page.locator("submit").click()
if "feed" in page.url:
     return "Success"
elif "challenge" in page.url:
     await page.wait_for_url("*", wait_until="domcontentloaded")
     email_challenge = page.locator("email_input")
     if await email_challenge.count() > 0:
        return "failed"

It fails email_cahllenge.count(), what's teh issue and how to handle this?

This thread is trying to answer question "How to handle redirection after submitting a form using Playwright?"

0 replies
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

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 luc@ray.run.