Skip to content

Commit 39da953

Browse files
committed
Fixed context options and video tests
1 parent 609274d commit 39da953

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

playwright/_impl/_browser_context.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def __init__(
116116
self._bindings: Dict[str, Any] = {}
117117
self._timeout_settings = TimeoutSettings(None)
118118
self._owner_page: Optional[Page] = None
119-
self._options: Dict[str, Any] = {}
119+
self._options: Dict[str, Any] = initializer.get("options", {})
120120
self._background_pages: Set[Page] = set()
121121
self._service_workers: Set[Worker] = set()
122122
self._tracing = cast(Tracing, from_channel(initializer["tracing"]))
@@ -302,15 +302,6 @@ def pages(self) -> List[Page]:
302302
def browser(self) -> Optional["Browser"]:
303303
return self._browser
304304

305-
def _set_options(self, context_options: Dict, browser_options: Dict) -> None:
306-
self._options = context_options
307-
if self._options.get("recordHar"):
308-
self._har_recorders[""] = {
309-
"path": self._options["recordHar"]["path"],
310-
"content": self._options["recordHar"].get("content"),
311-
}
312-
self._tracing._traces_dir = browser_options.get("tracesDir")
313-
314305
async def _initialize_har_from_options(self, options: Dict) -> None:
315306
record_har_path = options.get("recordHarPath")
316307
if not record_har_path:

playwright/_impl/_browser_type.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ async def launch(
9595
browser = cast(
9696
Browser, from_channel(await self._channel.send("launch", params))
9797
)
98-
browser._connect_to_browser_type(self, str(tracesDir))
98+
browser._connect_to_browser_type(
99+
self, str(tracesDir) if tracesDir is not None else None
100+
)
99101
return browser
100102

101103
async def launch_persistent_context(
@@ -163,7 +165,9 @@ async def launch_persistent_context(
163165
Browser,
164166
from_channel(result["browser"]),
165167
)
166-
browser._connect_to_browser_type(self, str(tracesDir))
168+
browser._connect_to_browser_type(
169+
self, str(tracesDir) if tracesDir is not None else None
170+
)
167171
context = cast(BrowserContext, from_channel(result["context"]))
168172
await context._initialize_har_from_options(
169173
{

0 commit comments

Comments
 (0)