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.
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