-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
Version
1.58.0
Steps to reproduce
- Clone my repo at https://github.com/fwdekker/playwright-python-har-bug
pip install -r requirements.txtpython main.py- After the web page is loaded, manually close the browser window. Either close the tab, or close the window.
- Check the contents of the
out/directory.
Expected behavior
The file out/recording.har is created.
Actual behavior
The file out/recording.har is not created.
Additional context
I understand that the context must be closed gracefully in order to ensure the .har is created. I expected await context.close() to be sufficient, but apparently adding an event listener for close changes things.
I do not encounter this bug when using the equivalent code on a non-persistent context.
Removing the line await event.wait() results in the recording.har being created correctly. However, this line is necessary to allow the user to manually decide when to close the window.
Environment
- Operating System: Windows 11
- CPU: amd64
- Browser: Chromium and Firefox. Not tested on Webkit
- Python Version: 3.14
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels