Version
1.60.0
Steps to reproduce
- Clone my repo at https://github.com/fwdekker-pc/playwright_python_non_persistent_events_not_fired
- Run
- Run
# EITHER
uv run playwright install firefox
# OR
PLAYWRIGHT_SKIP_BROWSER_GC=1 uv run playwright install firefox
# OR
$env:PLAYWRIGHT_SKIP_BROWSER_GC=1 ; uv run playwright install firefox
- Run
uv run -m playwright_python_non_persistent_events_not_fired
- The console says
# Persistent profile. Then a browser window pops up.
- Wait until the console says
Ready.
- Click inside the browser. Manually open a new tab, for example by pressing Ctrl + T, pressing Ctrl + N, or by clicking the new tab icon.
- Close the browser window.
- The console says
# Non-persistent profile. Then another browser window pops up.
- Wait until the console says
Ready once again.
- Click inside the browser. Manually open a new tab, for example by pressing Ctrl + T, pressing Ctrl + N, or by clicking the new tab icon.
- Close the browser window.
- Stop the script with Ctrl + C.
Expected behavior
After running
context.on("page", lambda: print("Page opened!"))
manually opening a new tab in the browser should print Page opened! to the console.
This should hold for both persistent and non-persistent contexts, and should work in all browsers.
Actual behavior
In Firefox, the Page opened! message is printed only in the persistent context. The page event is apparently not called for manually opened tabs.
In Chromium, the code works as expected.
Additional context
No response
Environment
- Operating System: Windows 11 25H2
- CPU: x64
- Browser: Firefox
- Python Version: 3.14
Version
1.60.0
Steps to reproduce
# Persistent profile. Then a browser window pops up.Ready.# Non-persistent profile. Then another browser window pops up.Readyonce again.Expected behavior
After running
manually opening a new tab in the browser should print
Page opened!to the console.This should hold for both persistent and non-persistent contexts, and should work in all browsers.
Actual behavior
In Firefox, the
Page opened!message is printed only in the persistent context. Thepageevent is apparently not called for manually opened tabs.In Chromium, the code works as expected.
Additional context
No response
Environment