In testing a webpage, I’ve changed the value of a “select option” element which filters the table on the page to only show matching data etc. After changing the value I use a locator to determine how many rows are in the table, and then I loop through the rows to confirm they match the filter. My issue right now is that because the next JavaScript lines don’t wait for the page to actually change from the initial table, the following Java script normally gets about halfway done before the table even changes. I am able to make it work with a “page.waitForURL” line after the action, but that is only because the specific filters are easily readable from the url. And I would like to have a better practice that is more widely applicable. Is there a best practice for waiting for the page content to respond to an action?
This thread is trying to answer question "Is there a best practice for waiting for the page content to respond to an action?"
try page.waitForLoadState()
https://playwright.dev/docs/api/class-page#page-wait-for-load-state
We are looking for more consistent alternatives to “waitfortimeout” but I am hoping I can get the wait for api response working because the waitForLoadState(‘networkidle’) seems to consistently take about twice as long as the wait for URL option
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].