Rayrun
← Back to Discord Forum

Waiting For Form Submission To Complete

stevanfreebornposted in #help-playwright
Open in Discord
stevanfreeborn
stevanfreeborn

Is there an established pattern for how to wait for a form submission to complete?

In my case when the form is submitted the page is essentially just reloaded.

Currently I've tried page.waitForURL() as well as page.waitForLoadState(), but both seem to be returning immediately since the form submission is not actually causing the URL to change.

Any advice?

This thread is trying to answer question "Is there an established pattern for how to wait for a form submission to complete when the form submission does not change the URL?"

2 replies

If there is a network request that is made with the form submission you can use something like - page.waitForResponse

https://playwright.dev/docs/api/class-page#page-wait-for-response

stevanfreeborn
stevanfreeborn

Yeah that seems to get me to where I'm going.

Feels a little clunky.

For context the overall scenario is...

+ load a form at GET /Admin/Security/User/1/Edit.

+ Submit the form at POST /Admin/Security/User/1/Edit

+ reload the form at GET /Admin/Security/User/1/Edit

Related Discord Threads

TwitterGitHubLinkedIn
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.