[Bug]: tracing.stop(path=...) and record_har_path ignore os.chdir() for relative paths
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 74/100
Hướng nghiên cứu
Người báo cáo chỉ vào Artifact.save_as, thứ đã tuyệt đối hóa đường dẫn của nó trước khi gửi đến driver; hãy bắt đầu ở đó và xem nó làm như thế nào. Sau đó tìm hai chỗ serialize tracing.stop(path=...) và tùy chọn context record_har_path đến driver và áp dụng cách xử lý tương tự. Script repro trong issue là bước kiểm tra: sau os.chdir(target), trace.zip và rel.har sẽ nằm trong cwd mới giống như shot.png, ở cả API sync và async.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version
1.65.2 (same on 1.64.0)
Steps to reproduce
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:
import os, tempfile
from playwright.sync_api import sync_playwright
start = os.getcwd()
with sync_playwright() as p:
target = tempfile.mkdtemp()
os.chdir(target)
ctx = p.chromium.launch().new_context(record_har_path="rel.har")
ctx.tracing.start()
page = ctx.new_page()
page.goto("data:text/html,x")
ctx.tracing.stop(path="trace.zip")
page.screenshot(path="shot.png")
ctx.close()
for f in ("trace.zip", "rel.har", "shot.png"):
print(f, os.path.exists(os.path.join(target, f)), os.path.exists(os.path.join(start, f)))
Expected behavior
All three files in target.
Actual behavior
trace.zip False True
rel.har False True
shot.png True False
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.
Additional context
No response
Environment
- Operating System: macOS 27.2
- CPU: arm64
- Browser: Chromium
- Python Version: 3.14
- Other info:
- Ngôn ngữ chính
- Python
- Star
- 15.1k
- Fork
- 1.3k
- Merge trung bình
- 6 giờ 16 phút
- Pull request đã merge (30 ngày)
- 53
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/playwright-python
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
microsoft/playwright-python#3360 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
microsoft/playwright-python#3362 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của microsoft/playwright-python
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
snap-stanford/Biomni#380 ·
-
documentation priority: low size: S status: needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
cubrid-lab/sqlalchemy-cubrid#1397 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation priority: low size: S status: needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
cubrid-lab/pycubrid#1307 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Installer hides SSL certificate errors as bare URLError, and the suggested fix can't workĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
ShaftHQ/chaosengine-harness#143 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug high-severity
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
aws/bedrock-agentcore-sdk-python#752 ·
Maintainer thường phản hồi trong vòng 1 ngày