You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: tracing.stop(path=...) and record_har_path ignore os.chdir() for relative paths #3361
Relative paths for traces and HARs are resolved against the directory the driver was started in, not the current one. Screenshots use the current one, so in one script the files end up in two places:
Hits anyone using monkeypatch.chdir() with a session-scoped playwright. Artifact.save_as already makes the path absolute before sending it; tracing and HAR don't.
Hi, I'm the Playwright bot. I reproduced this on macOS.
Reproduced on current main in Chromium, Firefox and WebKit. The Python process changes directory, but the driver keeps its startup directory. Trace and HAR paths reach the driver without being made absolute. The proposed fix resolves them in Python, before tracing stops or HAR recording starts.
The source change in #3363 also passes the independent regression. Its test fails the test-registry check because TR-043 already identifies another test. This proposal extends the existing Python tracing test instead.
Condensed repro
With the session-scoped browser fixture already started:
Without the fix, both files are written in the driver's startup directory. With the fix, both assertions pass.
What I ran
macOS 26.7.2, Python 3.14.10. Python checkout de03c865f5738c2291a6a58c8b5c20346d8e70f2 (1.65.1.dev24+gde03c865f), built with driver a018f24a4fc76e2120d3b35d2415f1e5bd4b073e (1.66.0-next). The reported published versions were not retested.
Check
Chromium
Firefox
WebKit
Independent regression on main, headless
Fails
Fails
Fails
Independent regression on #3363, a790c72ca8ea4a4f76ca444926bb6ff8ae9d0014
Upstream Node client: relative trace, HAR and screenshot paths after changing directory
Passes
Passes
Passes
The independent regression extends tests/sync/python/test_tracing.py::test_should_collect_sources, using a relative Path for the trace and a relative string for the HAR. Its failure without the source fix and success with it were checked again before preparing the proposal.
Neighboring tracing, HAR, browser-context HAR and HAR WebSocket files passed in separate sync and async runs across all three browsers: 467 sync tests and 482 async tests passed, with 7 existing skips in each run. The Python-only tracing files and async HAR file were included.
Full scripts/lint.sh and mypy playwright passed. Lint used Python 3.13 because the pinned Pyright version cannot parse Python 3.14's standard-library t-strings.
Hi, I'm the Playwright bot. I checked #3373 against the same regression before and after the roll.
Yes, #3373 fixes this on main. On macOS, relative trace, HAR and screenshot paths all use the Python process's current directory in Chromium, Firefox and WebKit. Before the roll, only the screenshot does.
The roll ports microsoft/playwright#44319: the client makes HAR paths absolute when recording starts and trace paths absolute before export. This is verified on main, not in a tagged release.
Regression and results
The existing tests/sync/python/test_tracing.py::test_should_collect_sources was temporarily extended with this case. The session-scoped browser starts before the directory change:
Before the roll, both the trace and HAR appear in the driver's startup directory, not tmp_path. After it, all three artifacts appear in tmp_path, and the existing trace-source viewer assertions also pass. No browser-specific difference.
Ran python -m pytest tests/sync/python/test_tracing.py -k test_should_collect_sources --browser chromium --browser firefox --browser webkit, and repeated the current-main run with --headed: three expected failures before the roll and six passes after it. The reported published versions were not retested in this pass.
Triaged on macOS by the Playwright bot - agent run
Activity
microsoft-playwright-automation commentedon Nov 23, 2026
microsoft-playwright-automation commentedon Nov 23, 2026
Hi, I'm the Playwright bot. I reproduced this on macOS.
Reproduced on current main in Chromium, Firefox and WebKit. The Python process changes directory, but the driver keeps its startup directory. Trace and HAR paths reach the driver without being made absolute. The proposed fix resolves them in Python, before tracing stops or HAR recording starts.
The source change in #3363 also passes the independent regression. Its test fails the test-registry check because
TR-043already identifies another test. This proposal extends the existing Python tracing test instead.Condensed repro
With the session-scoped
browserfixture already started:Without the fix, both files are written in the driver's startup directory. With the fix, both assertions pass.
What I ran
macOS 26.7.2, Python 3.14.10. Python checkout
de03c865f5738c2291a6a58c8b5c20346d8e70f2(1.65.1.dev24+gde03c865f), built with drivera018f24a4fc76e2120d3b35d2415f1e5bd4b073e(1.66.0-next). The reported published versions were not retested.a790c72ca8ea4a4f76ca444926bb6ff8ae9d0014The independent regression extends
tests/sync/python/test_tracing.py::test_should_collect_sources, using a relativePathfor the trace and a relative string for the HAR. Its failure without the source fix and success with it were checked again before preparing the proposal.Neighboring tracing, HAR, browser-context HAR and HAR WebSocket files passed in separate sync and async runs across all three browsers: 467 sync tests and 482 async tests passed, with 7 existing skips in each run. The Python-only tracing files and async HAR file were included.
Full
scripts/lint.shandmypy playwrightpassed. Lint used Python 3.13 because the pinned Pyright version cannot parse Python 3.14's standard-library t-strings.Draft PR: #3367
Triaged on macOS by the Playwright bot - agent run
dgozman commentedon Nov 25, 2026
Agent, let's check whether #3373 fixed this one.
microsoft-playwright-automation commentedon Nov 25, 2026
microsoft-playwright-automation commentedon Nov 25, 2026
Hi, I'm the Playwright bot. I checked #3373 against the same regression before and after the roll.
Yes, #3373 fixes this on main. On macOS, relative trace, HAR and screenshot paths all use the Python process's current directory in Chromium, Firefox and WebKit. Before the roll, only the screenshot does.
The roll ports microsoft/playwright#44319: the client makes HAR paths absolute when recording starts and trace paths absolute before export. This is verified on main, not in a tagged release.
Regression and results
The existing
tests/sync/python/test_tracing.py::test_should_collect_sourceswas temporarily extended with this case. The session-scoped browser starts before the directory change:Runner: macOS 26.7.2 arm64, Python 3.14.10. Each checkout was built with its own pinned driver, both identified as
1.66.0-next.8b452510884008b70c099a32089d4501c90c721ff31e7025d36bebc4b55c2e94f97f26ac92e13067f31e7025d36bebc4b55c2e94f97f26ac92e13067Before: Python
1.65.1.dev26+g8b4525108.d20261125, driver049226728d2da8054db18b04782a9848b755855e. After: Python1.65.1.dev27+gf31e7025d, driverb0e0b7b555e637cc8c0ce94dd98c3be153861333.Before the roll, both the trace and HAR appear in the driver's startup directory, not
tmp_path. After it, all three artifacts appear intmp_path, and the existing trace-source viewer assertions also pass. No browser-specific difference.Ran
python -m pytest tests/sync/python/test_tracing.py -k test_should_collect_sources --browser chromium --browser firefox --browser webkit, and repeated the current-main run with--headed: three expected failures before the roll and six passes after it. The reported published versions were not retested in this pass.Triaged on macOS by the Playwright bot - agent run