[Bug]: tracing.stop(path=...) and record_har_path ignore os.chdir() for relative paths
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 74/100
Línea de trabajo
La persona que reporta apunta a Artifact.save_as, que ya convierte su ruta en absoluta antes de enviarla al driver; empieza ahí y mira cómo lo hace. Luego encuentra los dos lugares que serializan tracing.stop(path=...) y la opción de contexto record_har_path al driver y dales el mismo tratamiento. El script de reproducción del issue es la comprobación: después de os.chdir(target), trace.zip y rel.har deberían terminar en el nuevo cwd igual que shot.png, tanto en las API sync como async.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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:
- Lenguaje dominante
- Python
- Estrellas
- 15.1k
- Forks
- 1.3k
- Merge medio
- 6 h 16 min
- PR fusionados (30 d)
- 53
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/playwright-python
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
microsoft/playwright-python#3360 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 62/100
microsoft/playwright-python#3362 ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/playwright-python
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
snap-stanford/Biomni#380 ·
-
documentation priority: low size: S status: needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
cubrid-lab/sqlalchemy-cubrid#1397 ·
Los mantenedores suelen responder en 1 día
-
documentation priority: low size: S status: needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
cubrid-lab/pycubrid#1307 ·
Los mantenedores suelen responder en 1 día
-
[Bug]: Installer hides SSL certificate errors as bare URLError, and the suggested fix can't workAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
ShaftHQ/chaosengine-harness#143 ·
Los mantenedores suelen responder en 1 día
-
bug high-severity
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
aws/bedrock-agentcore-sdk-python#752 ·
Los mantenedores suelen responder en 1 día