Rayrun
← Back to Discord Forum

Does Playwright wait for "load" event to be fired by all firames?

I have very interesting but also frustrating problem in our tests. Our tests are failing quite frequently with following error (screenshot). I suspect that Playwright starts listening for "load" event too late, after event was actually dispatched.

So I prepared a workaround which dispatches "load" event manually when app initialized. This reduced number of failures significantly but they still happen. I have 100% confidence that I am dispatching this "load" event.

So I started thinking if Playwright is also waiting for load events from iframes that are in the page. I think I recall some code in PW repo that tracks iframe states in the page but I don't remember where it was and what actually it was doing. Hence my question. I would really like to understand how waiting for "load" event works in order to solve this problem in our tests.

Screenshot_2023-11-10_at_11.17.36.png

This thread is trying to answer question "Does Playwright wait for 'load' event to be fired by all iframes?"

2 replies

Some additional context

  • SPA React app with some legacy code
  • React Router
  • We build 'test' bundle and serve it locally with http server
  • Before test starts, we inject additional bundled script for mocking API calls (MSW+logic for simulating backend), we use addInitScript method for it

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 [email protected].