Skip to content

Commit 609274d

Browse files
committed
Fix HAR path interpretation
1 parent 5ad2780 commit 609274d

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

playwright/_impl/_browser_context.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,11 @@ def _set_options(self, context_options: Dict, browser_options: Dict) -> None:
312312
self._tracing._traces_dir = browser_options.get("tracesDir")
313313

314314
async def _initialize_har_from_options(self, options: Dict) -> None:
315-
record_har_path = str(options["recordHarPath"])
316-
if not record_har_path or len(record_har_path) == 0:
315+
record_har_path = options.get("recordHarPath")
316+
if not record_har_path:
317+
return
318+
record_har_path = str(record_har_path)
319+
if len(record_har_path) == 0:
317320
return
318321
default_policy = "attach" if record_har_path.endswith(".zip") else "embed"
319322
content_policy = options.get(

tests/async/test_browsertype_connect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ async def test_should_record_trace_with_source(
358358
re.compile(r"test_should_record_trace_with_source"),
359359
]
360360
)
361-
await trace_viewer.select_action("Page.set_content")
361+
await trace_viewer.select_action("Set content")
362362
# Check that the source file is shown
363363
await expect(
364364
trace_viewer.page.locator(".source-tab-file-name")

0 commit comments

Comments
 (0)