We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[Bug]: `record_har_omit_content` does not work properly
### Playwright version

1.15.3

### Operating system

Linux

### What browsers are you seeing the problem on?

Chromium, Firefox, WebKit

### Other information

Repo to present bug:
https://github.com/qwark97/har_omit_content_bug

Bug occurs also outside the docker image

### What happened? / Describe the bug

Using `record_har_omit_content` as a `new_page` parameter can manipulate presence of the `text` filed inside `entry.response.content` object in `.har` file.

Not using this parameter (defaults to `False` https://playwright.dev/python/docs/api/class-browser#browser-new-page) allows to see `text` inside `.har` file. Using `record_har_omit_content=True` also works as expected - `text` is absent. Unfortunatelly, passing `record_har_omit_content=False` explicitely **does not** work as expected -> `.har` file **will not** contain `text` filed.

It also looks like passing anything except explicit `None` as a `record_har_omit_content` value (type doesn't matter) will cause with missing `text` filed

### Code snippet to reproduce your bug

_No response_

### Relevant log output

_No response_

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `playwright/_impl/_browser.py`
Content:
```
1 # Copyright (c) Microsoft Corporation.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 
15 import base64
16 import json
17 from pathlib import Path
18 from types import SimpleNamespace
19 from typing import TYPE_CHECKING, Dict, List, Union
20 
21 from playwright._impl._api_structures import (
22     Geolocation,
23     HttpCredentials,
24     ProxySettings,
25     StorageState,
26     ViewportSize,
27 )
28 from playwright._impl._browser_context import BrowserContext
29 from playwright._impl._cdp_session import CDPSession
30 from playwright._impl._connection import ChannelOwner, from_channel
31 from playwright._impl._helper import (
32     ColorScheme,
33     ForcedColors,
34     ReducedMotion,
35     async_readfile,
36     is_safe_close_error,
37     locals_to_params,
38 )
39 from playwright._impl._network import serialize_headers
40 from playwright._impl._page import Page
41 
42 if TYPE_CHECKING:  # pragma: no cover
43     from playwright._impl._browser_type import BrowserType
44 
45 
46 class Browser(ChannelOwner):
47 
48     Events = SimpleNamespace(
49         Disconnected="disconnected",
50     )
51 
52     def __init__(
53         self, parent: "BrowserType", type: str, guid: str, initializer: Dict
54     ) -> None:
55         super().__init__(parent, type, guid, initializer)
56         self._browser_type = parent
57         self._is_connected = True
58         self._is_closed_or_closing = False
59         self._is_remote = False
60         self._is_connected_over_websocket = False
61 
62         self._contexts: List[BrowserContext] = []
63         self._channel.on("close", lambda _: self._on_close())
64 
65     def __repr__(self) -> str:
66         return f"<Browser type={self._browser_type} version={self.version}>"
67 
68     def _on_close(self) -> None:
69         self._is_connected = False
70         self.emit(Browser.Events.Disconnected, self)
71         self._is_closed_or_closing = True
72 
73     @property
74     def contexts(self) -> List[BrowserContext]:
75         return self._contexts.copy()
76 
77     def is_connected(self) -> bool:
78         return self._is_connected
79 
80     async def new_context(
81         self,
82         viewport: ViewportSize = None,
83         screen: ViewportSize = None,
84         noViewport: bool = None,
85         ignoreHTTPSErrors: bool = None,
86         javaScriptEnabled: bool = None,
87         bypassCSP: bool = None,
88         userAgent: str = None,
89         locale: str = None,
90         timezoneId: str = None,
91         geolocation: Geolocation = None,
92         permissions: List[str] = None,
93         extraHTTPHeaders: Dict[str, str] = None,
94         offline: bool = None,
95         httpCredentials: HttpCredentials = None,
96         deviceScaleFactor: float = None,
97         isMobile: bool = None,
98         hasTouch: bool = None,
99         colorScheme: ColorScheme = None,
100         reducedMotion: ReducedMotion = None,
101         forcedColors: ForcedColors = None,
102         acceptDownloads: bool = None,
103         defaultBrowserType: str = None,
104         proxy: ProxySettings = None,
105         recordHarPath: Union[Path, str] = None,
106         recordHarOmitContent: bool = None,
107         recordVideoDir: Union[Path, str] = None,
108         recordVideoSize: ViewportSize = None,
109         storageState: Union[StorageState, str, Path] = None,
110         baseURL: str = None,
111         strictSelectors: bool = None,
112     ) -> BrowserContext:
113         params = locals_to_params(locals())
114         await normalize_context_params(self._connection._is_sync, params)
115 
116         channel = await self._channel.send("newContext", params)
117         context = from_channel(channel)
118         self._contexts.append(context)
119         context._browser = self
120         context._options = params
121         return context
122 
123     async def new_page(
124         self,
125         viewport: ViewportSize = None,
126         screen: ViewportSize = None,
127         noViewport: bool = None,
128         ignoreHTTPSErrors: bool = None,
129         javaScriptEnabled: bool = None,
130         bypassCSP: bool = None,
131         userAgent: str = None,
132         locale: str = None,
133         timezoneId: str = None,
134         geolocation: Geolocation = None,
135         permissions: List[str] = None,
136         extraHTTPHeaders: Dict[str, str] = None,
137         offline: bool = None,
138         httpCredentials: HttpCredentials = None,
139         deviceScaleFactor: float = None,
140         isMobile: bool = None,
141         hasTouch: bool = None,
142         colorScheme: ColorScheme = None,
143         forcedColors: ForcedColors = None,
144         reducedMotion: ReducedMotion = None,
145         acceptDownloads: bool = None,
146         defaultBrowserType: str = None,
147         proxy: ProxySettings = None,
148         recordHarPath: Union[Path, str] = None,
149         recordHarOmitContent: bool = None,
150         recordVideoDir: Union[Path, str] = None,
151         recordVideoSize: ViewportSize = None,
152         storageState: Union[StorageState, str, Path] = None,
153         baseURL: str = None,
154         strictSelectors: bool = None,
155     ) -> Page:
156         params = locals_to_params(locals())
157         context = await self.new_context(**params)
158         page = await context.new_page()
159         page._owned_context = context
160         context._owner_page = page
161         return page
162 
163     async def close(self) -> None:
164         if self._is_closed_or_closing:
165             return
166         self._is_closed_or_closing = True
167         try:
168             await self._channel.send("close")
169         except Exception as e:
170             if not is_safe_close_error(e):
171                 raise e
172         if self._is_connected_over_websocket:
173             await self._connection.stop_async()
174 
175     @property
176     def version(self) -> str:
177         return self._initializer["version"]
178 
179     async def new_browser_cdp_session(self) -> CDPSession:
180         return from_channel(await self._channel.send("newBrowserCDPSession"))
181 
182     async def start_tracing(
183         self,
184         page: Page = None,
185         path: Union[str, Path] = None,
186         screenshots: bool = None,
187         categories: List[str] = None,
188     ) -> None:
189         params = locals_to_params(locals())
190         if page:
191             params["page"] = page._channel
192         if path:
193             params["path"] = str(path)
194         await self._channel.send("startTracing", params)
195 
196     async def stop_tracing(self) -> bytes:
197         encoded_binary = await self._channel.send("stopTracing")
198         return base64.b64decode(encoded_binary)
199 
200 
201 async def normalize_context_params(is_sync: bool, params: Dict) -> None:
202     params["sdkLanguage"] = "python" if is_sync else "python-async"
203     if params.get("noViewport"):
204         del params["noViewport"]
205         params["noDefaultViewport"] = True
206     if "defaultBrowserType" in params:
207         del params["defaultBrowserType"]
208     if "extraHTTPHeaders" in params:
209         params["extraHTTPHeaders"] = serialize_headers(params["extraHTTPHeaders"])
210     if "recordHarPath" in params:
211         params["recordHar"] = {"path": str(params["recordHarPath"])}
212         if "recordHarOmitContent" in params:
213             params["recordHar"]["omitContent"] = True
214             del params["recordHarOmitContent"]
215         del params["recordHarPath"]
216     if "recordVideoDir" in params:
217         params["recordVideo"] = {"dir": str(params["recordVideoDir"])}
218         if "recordVideoSize" in params:
219             params["recordVideo"]["size"] = params["recordVideoSize"]
220             del params["recordVideoSize"]
221         del params["recordVideoDir"]
222     if "storageState" in params:
223         storageState = params["storageState"]
224         if not isinstance(storageState, dict):
225             params["storageState"] = json.loads(
226                 (await async_readfile(storageState)).decode()
227             )
228
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/playwright/_impl/_browser.py b/playwright/_impl/_browser.py
--- a/playwright/_impl/_browser.py
+++ b/playwright/_impl/_browser.py
@@ -210,7 +210,7 @@
     if "recordHarPath" in params:
         params["recordHar"] = {"path": str(params["recordHarPath"])}
         if "recordHarOmitContent" in params:
-            params["recordHar"]["omitContent"] = True
+            params["recordHar"]["omitContent"] = params["recordHarOmitContent"]
             del params["recordHarOmitContent"]
         del params["recordHarPath"]
     if "recordVideoDir" in params:

{"golden_diff": "diff --git a/playwright/_impl/_browser.py b/playwright/_impl/_browser.py\n--- a/playwright/_impl/_browser.py\n+++ b/playwright/_impl/_browser.py\n@@ -210,7 +210,7 @@\n     if \"recordHarPath\" in params:\n         params[\"recordHar\"] = {\"path\": str(params[\"recordHarPath\"])}\n         if \"recordHarOmitContent\" in params:\n-            params[\"recordHar\"][\"omitContent\"] = True\n+            params[\"recordHar\"][\"omitContent\"] = params[\"recordHarOmitContent\"]\n             del params[\"recordHarOmitContent\"]\n         del params[\"recordHarPath\"]\n     if \"recordVideoDir\" in params:\n", "issue": "[Bug]: `record_har_omit_content` does not work properly\n### Playwright version\r\n\r\n1.15.3\r\n\r\n### Operating system\r\n\r\nLinux\r\n\r\n### What browsers are you seeing the problem on?\r\n\r\nChromium, Firefox, WebKit\r\n\r\n### Other information\r\n\r\nRepo to present bug:\r\nhttps://github.com/qwark97/har_omit_content_bug\r\n\r\nBug occurs also outside the docker image\r\n\r\n### What happened? / Describe the bug\r\n\r\nUsing `record_har_omit_content` as a `new_page` parameter can manipulate presence of the `text` filed inside `entry.response.content` object in `.har` file.\r\n\r\nNot using this parameter (defaults to `False` https://playwright.dev/python/docs/api/class-browser#browser-new-page) allows to see `text` inside `.har` file. Using `record_har_omit_content=True` also works as expected - `text` is absent. Unfortunatelly, passing `record_har_omit_content=False` explicitely **does not** work as expected -> `.har` file **will not** contain `text` filed.\r\n\r\nIt also looks like passing anything except explicit `None` as a `record_har_omit_content` value (type doesn't matter) will cause with missing `text` filed\r\n\r\n### Code snippet to reproduce your bug\r\n\r\n_No response_\r\n\r\n### Relevant log output\r\n\r\n_No response_\n", "before_files": [{"content": "# Copyright (c) Microsoft Corporation.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport base64\nimport json\nfrom pathlib import Path\nfrom types import SimpleNamespace\nfrom typing import TYPE_CHECKING, Dict, List, Union\n\nfrom playwright._impl._api_structures import (\n    Geolocation,\n    HttpCredentials,\n    ProxySettings,\n    StorageState,\n    ViewportSize,\n)\nfrom playwright._impl._browser_context import BrowserContext\nfrom playwright._impl._cdp_session import CDPSession\nfrom playwright._impl._connection import ChannelOwner, from_channel\nfrom playwright._impl._helper import (\n    ColorScheme,\n    ForcedColors,\n    ReducedMotion,\n    async_readfile,\n    is_safe_close_error,\n    locals_to_params,\n)\nfrom playwright._impl._network import serialize_headers\nfrom playwright._impl._page import Page\n\nif TYPE_CHECKING:  # pragma: no cover\n    from playwright._impl._browser_type import BrowserType\n\n\nclass Browser(ChannelOwner):\n\n    Events = SimpleNamespace(\n        Disconnected=\"disconnected\",\n    )\n\n    def __init__(\n        self, parent: \"BrowserType\", type: str, guid: str, initializer: Dict\n    ) -> None:\n        super().__init__(parent, type, guid, initializer)\n        self._browser_type = parent\n        self._is_connected = True\n        self._is_closed_or_closing = False\n        self._is_remote = False\n        self._is_connected_over_websocket = False\n\n        self._contexts: List[BrowserContext] = []\n        self._channel.on(\"close\", lambda _: self._on_close())\n\n    def __repr__(self) -> str:\n        return f\"<Browser type={self._browser_type} version={self.version}>\"\n\n    def _on_close(self) -> None:\n        self._is_connected = False\n        self.emit(Browser.Events.Disconnected, self)\n        self._is_closed_or_closing = True\n\n    @property\n    def contexts(self) -> List[BrowserContext]:\n        return self._contexts.copy()\n\n    def is_connected(self) -> bool:\n        return self._is_connected\n\n    async def new_context(\n        self,\n        viewport: ViewportSize = None,\n        screen: ViewportSize = None,\n        noViewport: bool = None,\n        ignoreHTTPSErrors: bool = None,\n        javaScriptEnabled: bool = None,\n        bypassCSP: bool = None,\n        userAgent: str = None,\n        locale: str = None,\n        timezoneId: str = None,\n        geolocation: Geolocation = None,\n        permissions: List[str] = None,\n        extraHTTPHeaders: Dict[str, str] = None,\n        offline: bool = None,\n        httpCredentials: HttpCredentials = None,\n        deviceScaleFactor: float = None,\n        isMobile: bool = None,\n        hasTouch: bool = None,\n        colorScheme: ColorScheme = None,\n        reducedMotion: ReducedMotion = None,\n        forcedColors: ForcedColors = None,\n        acceptDownloads: bool = None,\n        defaultBrowserType: str = None,\n        proxy: ProxySettings = None,\n        recordHarPath: Union[Path, str] = None,\n        recordHarOmitContent: bool = None,\n        recordVideoDir: Union[Path, str] = None,\n        recordVideoSize: ViewportSize = None,\n        storageState: Union[StorageState, str, Path] = None,\n        baseURL: str = None,\n        strictSelectors: bool = None,\n    ) -> BrowserContext:\n        params = locals_to_params(locals())\n        await normalize_context_params(self._connection._is_sync, params)\n\n        channel = await self._channel.send(\"newContext\", params)\n        context = from_channel(channel)\n        self._contexts.append(context)\n        context._browser = self\n        context._options = params\n        return context\n\n    async def new_page(\n        self,\n        viewport: ViewportSize = None,\n        screen: ViewportSize = None,\n        noViewport: bool = None,\n        ignoreHTTPSErrors: bool = None,\n        javaScriptEnabled: bool = None,\n        bypassCSP: bool = None,\n        userAgent: str = None,\n        locale: str = None,\n        timezoneId: str = None,\n        geolocation: Geolocation = None,\n        permissions: List[str] = None,\n        extraHTTPHeaders: Dict[str, str] = None,\n        offline: bool = None,\n        httpCredentials: HttpCredentials = None,\n        deviceScaleFactor: float = None,\n        isMobile: bool = None,\n        hasTouch: bool = None,\n        colorScheme: ColorScheme = None,\n        forcedColors: ForcedColors = None,\n        reducedMotion: ReducedMotion = None,\n        acceptDownloads: bool = None,\n        defaultBrowserType: str = None,\n        proxy: ProxySettings = None,\n        recordHarPath: Union[Path, str] = None,\n        recordHarOmitContent: bool = None,\n        recordVideoDir: Union[Path, str] = None,\n        recordVideoSize: ViewportSize = None,\n        storageState: Union[StorageState, str, Path] = None,\n        baseURL: str = None,\n        strictSelectors: bool = None,\n    ) -> Page:\n        params = locals_to_params(locals())\n        context = await self.new_context(**params)\n        page = await context.new_page()\n        page._owned_context = context\n        context._owner_page = page\n        return page\n\n    async def close(self) -> None:\n        if self._is_closed_or_closing:\n            return\n        self._is_closed_or_closing = True\n        try:\n            await self._channel.send(\"close\")\n        except Exception as e:\n            if not is_safe_close_error(e):\n                raise e\n        if self._is_connected_over_websocket:\n            await self._connection.stop_async()\n\n    @property\n    def version(self) -> str:\n        return self._initializer[\"version\"]\n\n    async def new_browser_cdp_session(self) -> CDPSession:\n        return from_channel(await self._channel.send(\"newBrowserCDPSession\"))\n\n    async def start_tracing(\n        self,\n        page: Page = None,\n        path: Union[str, Path] = None,\n        screenshots: bool = None,\n        categories: List[str] = None,\n    ) -> None:\n        params = locals_to_params(locals())\n        if page:\n            params[\"page\"] = page._channel\n        if path:\n            params[\"path\"] = str(path)\n        await self._channel.send(\"startTracing\", params)\n\n    async def stop_tracing(self) -> bytes:\n        encoded_binary = await self._channel.send(\"stopTracing\")\n        return base64.b64decode(encoded_binary)\n\n\nasync def normalize_context_params(is_sync: bool, params: Dict) -> None:\n    params[\"sdkLanguage\"] = \"python\" if is_sync else \"python-async\"\n    if params.get(\"noViewport\"):\n        del params[\"noViewport\"]\n        params[\"noDefaultViewport\"] = True\n    if \"defaultBrowserType\" in params:\n        del params[\"defaultBrowserType\"]\n    if \"extraHTTPHeaders\" in params:\n        params[\"extraHTTPHeaders\"] = serialize_headers(params[\"extraHTTPHeaders\"])\n    if \"recordHarPath\" in params:\n        params[\"recordHar\"] = {\"path\": str(params[\"recordHarPath\"])}\n        if \"recordHarOmitContent\" in params:\n            params[\"recordHar\"][\"omitContent\"] = True\n            del params[\"recordHarOmitContent\"]\n        del params[\"recordHarPath\"]\n    if \"recordVideoDir\" in params:\n        params[\"recordVideo\"] = {\"dir\": str(params[\"recordVideoDir\"])}\n        if \"recordVideoSize\" in params:\n            params[\"recordVideo\"][\"size\"] = params[\"recordVideoSize\"]\n            del params[\"recordVideoSize\"]\n        del params[\"recordVideoDir\"]\n    if \"storageState\" in params:\n        storageState = params[\"storageState\"]\n        if not isinstance(storageState, dict):\n            params[\"storageState\"] = json.loads(\n                (await async_readfile(storageState)).decode()\n            )\n", "path": "playwright/_impl/_browser.py"}], "after_files": [{"content": "# Copyright (c) Microsoft Corporation.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport base64\nimport json\nfrom pathlib import Path\nfrom types import SimpleNamespace\nfrom typing import TYPE_CHECKING, Dict, List, Union\n\nfrom playwright._impl._api_structures import (\n    Geolocation,\n    HttpCredentials,\n    ProxySettings,\n    StorageState,\n    ViewportSize,\n)\nfrom playwright._impl._browser_context import BrowserContext\nfrom playwright._impl._cdp_session import CDPSession\nfrom playwright._impl._connection import ChannelOwner, from_channel\nfrom playwright._impl._helper import (\n    ColorScheme,\n    ForcedColors,\n    ReducedMotion,\n    async_readfile,\n    is_safe_close_error,\n    locals_to_params,\n)\nfrom playwright._impl._network import serialize_headers\nfrom playwright._impl._page import Page\n\nif TYPE_CHECKING:  # pragma: no cover\n    from playwright._impl._browser_type import BrowserType\n\n\nclass Browser(ChannelOwner):\n\n    Events = SimpleNamespace(\n        Disconnected=\"disconnected\",\n    )\n\n    def __init__(\n        self, parent: \"BrowserType\", type: str, guid: str, initializer: Dict\n    ) -> None:\n        super().__init__(parent, type, guid, initializer)\n        self._browser_type = parent\n        self._is_connected = True\n        self._is_closed_or_closing = False\n        self._is_remote = False\n        self._is_connected_over_websocket = False\n\n        self._contexts: List[BrowserContext] = []\n        self._channel.on(\"close\", lambda _: self._on_close())\n\n    def __repr__(self) -> str:\n        return f\"<Browser type={self._browser_type} version={self.version}>\"\n\n    def _on_close(self) -> None:\n        self._is_connected = False\n        self.emit(Browser.Events.Disconnected, self)\n        self._is_closed_or_closing = True\n\n    @property\n    def contexts(self) -> List[BrowserContext]:\n        return self._contexts.copy()\n\n    def is_connected(self) -> bool:\n        return self._is_connected\n\n    async def new_context(\n        self,\n        viewport: ViewportSize = None,\n        screen: ViewportSize = None,\n        noViewport: bool = None,\n        ignoreHTTPSErrors: bool = None,\n        javaScriptEnabled: bool = None,\n        bypassCSP: bool = None,\n        userAgent: str = None,\n        locale: str = None,\n        timezoneId: str = None,\n        geolocation: Geolocation = None,\n        permissions: List[str] = None,\n        extraHTTPHeaders: Dict[str, str] = None,\n        offline: bool = None,\n        httpCredentials: HttpCredentials = None,\n        deviceScaleFactor: float = None,\n        isMobile: bool = None,\n        hasTouch: bool = None,\n        colorScheme: ColorScheme = None,\n        reducedMotion: ReducedMotion = None,\n        forcedColors: ForcedColors = None,\n        acceptDownloads: bool = None,\n        defaultBrowserType: str = None,\n        proxy: ProxySettings = None,\n        recordHarPath: Union[Path, str] = None,\n        recordHarOmitContent: bool = None,\n        recordVideoDir: Union[Path, str] = None,\n        recordVideoSize: ViewportSize = None,\n        storageState: Union[StorageState, str, Path] = None,\n        baseURL: str = None,\n        strictSelectors: bool = None,\n    ) -> BrowserContext:\n        params = locals_to_params(locals())\n        await normalize_context_params(self._connection._is_sync, params)\n\n        channel = await self._channel.send(\"newContext\", params)\n        context = from_channel(channel)\n        self._contexts.append(context)\n        context._browser = self\n        context._options = params\n        return context\n\n    async def new_page(\n        self,\n        viewport: ViewportSize = None,\n        screen: ViewportSize = None,\n        noViewport: bool = None,\n        ignoreHTTPSErrors: bool = None,\n        javaScriptEnabled: bool = None,\n        bypassCSP: bool = None,\n        userAgent: str = None,\n        locale: str = None,\n        timezoneId: str = None,\n        geolocation: Geolocation = None,\n        permissions: List[str] = None,\n        extraHTTPHeaders: Dict[str, str] = None,\n        offline: bool = None,\n        httpCredentials: HttpCredentials = None,\n        deviceScaleFactor: float = None,\n        isMobile: bool = None,\n        hasTouch: bool = None,\n        colorScheme: ColorScheme = None,\n        forcedColors: ForcedColors = None,\n        reducedMotion: ReducedMotion = None,\n        acceptDownloads: bool = None,\n        defaultBrowserType: str = None,\n        proxy: ProxySettings = None,\n        recordHarPath: Union[Path, str] = None,\n        recordHarOmitContent: bool = None,\n        recordVideoDir: Union[Path, str] = None,\n        recordVideoSize: ViewportSize = None,\n        storageState: Union[StorageState, str, Path] = None,\n        baseURL: str = None,\n        strictSelectors: bool = None,\n    ) -> Page:\n        params = locals_to_params(locals())\n        context = await self.new_context(**params)\n        page = await context.new_page()\n        page._owned_context = context\n        context._owner_page = page\n        return page\n\n    async def close(self) -> None:\n        if self._is_closed_or_closing:\n            return\n        self._is_closed_or_closing = True\n        try:\n            await self._channel.send(\"close\")\n        except Exception as e:\n            if not is_safe_close_error(e):\n                raise e\n        if self._is_connected_over_websocket:\n            await self._connection.stop_async()\n\n    @property\n    def version(self) -> str:\n        return self._initializer[\"version\"]\n\n    async def new_browser_cdp_session(self) -> CDPSession:\n        return from_channel(await self._channel.send(\"newBrowserCDPSession\"))\n\n    async def start_tracing(\n        self,\n        page: Page = None,\n        path: Union[str, Path] = None,\n        screenshots: bool = None,\n        categories: List[str] = None,\n    ) -> None:\n        params = locals_to_params(locals())\n        if page:\n            params[\"page\"] = page._channel\n        if path:\n            params[\"path\"] = str(path)\n        await self._channel.send(\"startTracing\", params)\n\n    async def stop_tracing(self) -> bytes:\n        encoded_binary = await self._channel.send(\"stopTracing\")\n        return base64.b64decode(encoded_binary)\n\n\nasync def normalize_context_params(is_sync: bool, params: Dict) -> None:\n    params[\"sdkLanguage\"] = \"python\" if is_sync else \"python-async\"\n    if params.get(\"noViewport\"):\n        del params[\"noViewport\"]\n        params[\"noDefaultViewport\"] = True\n    if \"defaultBrowserType\" in params:\n        del params[\"defaultBrowserType\"]\n    if \"extraHTTPHeaders\" in params:\n        params[\"extraHTTPHeaders\"] = serialize_headers(params[\"extraHTTPHeaders\"])\n    if \"recordHarPath\" in params:\n        params[\"recordHar\"] = {\"path\": str(params[\"recordHarPath\"])}\n        if \"recordHarOmitContent\" in params:\n            params[\"recordHar\"][\"omitContent\"] = params[\"recordHarOmitContent\"]\n            del params[\"recordHarOmitContent\"]\n        del params[\"recordHarPath\"]\n    if \"recordVideoDir\" in params:\n        params[\"recordVideo\"] = {\"dir\": str(params[\"recordVideoDir\"])}\n        if \"recordVideoSize\" in params:\n            params[\"recordVideo\"][\"size\"] = params[\"recordVideoSize\"]\n            del params[\"recordVideoSize\"]\n        del params[\"recordVideoDir\"]\n    if \"storageState\" in params:\n        storageState = params[\"storageState\"]\n        if not isinstance(storageState, dict):\n            params[\"storageState\"] = json.loads(\n                (await async_readfile(storageState)).decode()\n            )\n", "path": "playwright/_impl/_browser.py"}]}