0

I want to run some actions as soon as any page is loaded in Playwright (in library mode):

load page A
run common post-load actions              <---
run specific actions for page A

load page B
run common post-load actions              <---
run specific actions for page B

etc.

I found the DOMContentLoaded event, and added my general post-load actions in a suitable event handler. But Playwright doesn't wait for my code to complete, so I assume (?) that is not a supported scenario - it's probably just for small/quick scripts, etc.

Is there a way to do this?

lonix
  • 14,255
  • 23
  • 85
  • 176

1 Answers1

1

Some time, the browser default finish to load timeout is 500ms, so if the page main asset load, but there is more data to wait for,

you should wait for the LAST element loaded in the post-load actions or to make additional method that verify all assets are indeed loaded.