We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Test coverage plan
- [x] browser
- [x] defaultbrowsercontext wip

---
- [x] cookies
- [x] emulation
- [x] dispatchevent
- [x] headful
- [x] dialog
- [x] focus
- [x] geolocation
- [x] accessibility
- [x] add_init_script
- [x] browsercontext
- [x] check
- [x] click
- [x] console
- [x] download
- [x] element_handle
- [x] evaluate
- [x] fill
- [x] frames
- [x] generation
- [x] ignore_https_errors
- [x] input
- [x] interception
- [x] jshandle
- [x] keyboard
- [x] launcher
- [x] navigation
- [x] network
- [x] page
- [x] pdf
- [x] popup
- [x] queryselector
- [x] worker


--- 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/browser_type.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 from pathlib import Path
16 from typing import Dict, List, Union
17 
18 from playwright.browser import Browser
19 from playwright.browser_context import BrowserContext
20 from playwright.browser_server import BrowserServer
21 from playwright.connection import ChannelOwner, from_channel
22 from playwright.helper import (
23     ColorScheme,
24     Credentials,
25     Env,
26     Geolocation,
27     IntSize,
28     ProxyServer,
29     locals_to_params,
30     not_installed_error,
31 )
32 
33 
34 class BrowserType(ChannelOwner):
35     def __init__(
36         self, parent: ChannelOwner, type: str, guid: str, initializer: Dict
37     ) -> None:
38         super().__init__(parent, type, guid, initializer)
39 
40     @property
41     def name(self) -> str:
42         return self._initializer["name"]
43 
44     @property
45     def executablePath(self) -> str:
46         return self._initializer["executablePath"]
47 
48     async def launch(
49         self,
50         executablePath: str = None,
51         args: List[str] = None,
52         ignoreDefaultArgs: Union[bool, List[str]] = None,
53         handleSIGINT: bool = None,
54         handleSIGTERM: bool = None,
55         handleSIGHUP: bool = None,
56         timeout: int = None,
57         env: Env = None,
58         headless: bool = None,
59         devtools: bool = None,
60         proxy: ProxyServer = None,
61         downloadsPath: str = None,
62         slowMo: int = None,
63         chromiumSandbox: bool = None,
64     ) -> Browser:
65         params = locals_to_params(locals())
66         normalize_launch_params(params)
67         try:
68             return from_channel(await self._channel.send("launch", params))
69         except Exception as e:
70             if f"{self.name}-" in str(e):
71                 raise not_installed_error(f'"{self.name}" browser was not found.')
72             raise e
73 
74     async def launchServer(
75         self,
76         executablePath: str = None,
77         args: List[str] = None,
78         ignoreDefaultArgs: Union[bool, List[str]] = None,
79         handleSIGINT: bool = None,
80         handleSIGTERM: bool = None,
81         handleSIGHUP: bool = None,
82         timeout: int = None,
83         env: Env = None,
84         headless: bool = None,
85         devtools: bool = None,
86         proxy: ProxyServer = None,
87         downloadsPath: str = None,
88         port: int = None,
89         chromiumSandbox: bool = None,
90     ) -> BrowserServer:
91         params = locals_to_params(locals())
92         normalize_launch_params(params)
93         try:
94             return from_channel(await self._channel.send("launchServer", params))
95         except Exception as e:
96             if f"{self.name}-" in str(e):
97                 raise not_installed_error(f'"{self.name}" browser was not found.')
98             raise e
99 
100     async def launchPersistentContext(
101         self,
102         userDataDir: str,
103         executablePath: str = None,
104         args: List[str] = None,
105         ignoreDefaultArgs: Union[bool, List[str]] = None,
106         handleSIGINT: bool = None,
107         handleSIGTERM: bool = None,
108         handleSIGHUP: bool = None,
109         timeout: int = None,
110         env: Env = None,
111         headless: bool = None,
112         devtools: bool = None,
113         proxy: ProxyServer = None,
114         downloadsPath: str = None,
115         slowMo: int = None,
116         viewport: IntSize = None,
117         ignoreHTTPSErrors: bool = None,
118         javaScriptEnabled: bool = None,
119         bypassCSP: bool = None,
120         userAgent: str = None,
121         locale: str = None,
122         timezoneId: str = None,
123         geolocation: Geolocation = None,
124         permissions: List[str] = None,
125         extraHTTPHeaders: Dict[str, str] = None,
126         offline: bool = None,
127         httpCredentials: Credentials = None,
128         deviceScaleFactor: int = None,
129         isMobile: bool = None,
130         hasTouch: bool = None,
131         colorScheme: ColorScheme = None,
132         acceptDownloads: bool = None,
133         chromiumSandbox: bool = None,
134     ) -> BrowserContext:
135         userDataDir = str(Path(userDataDir))
136         params = locals_to_params(locals())
137         normalize_launch_params(params)
138         try:
139             return from_channel(
140                 await self._channel.send("launchPersistentContext", params)
141             )
142         except Exception as e:
143             if f"{self.name}-" in str(e):
144                 raise not_installed_error(f'"{self.name}" browser was not found.')
145             raise e
146 
147     async def connect(
148         self, wsEndpoint: str, slowMo: int = None, timeout: int = None
149     ) -> Browser:
150         return from_channel(
151             await self._channel.send("connect", locals_to_params(locals()))
152         )
153 
154 
155 def normalize_launch_params(params: Dict) -> None:
156     if "env" in params:
157         params["env"] = {name: str(value) for [name, value] in params["env"].items()}
158     if "ignoreDefaultArgs" in params:
159         if isinstance(params["ignoreDefaultArgs"], bool):
160             params["ignoreAllDefaultArgs"] = True
161             del params["ignoreDefaultArgs"]
162         params["env"] = {name: str(value) for [name, value] in params["env"].items()}
163
```
--- 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/browser_type.py b/playwright/browser_type.py
--- a/playwright/browser_type.py
+++ b/playwright/browser_type.py
@@ -29,6 +29,7 @@
     locals_to_params,
     not_installed_error,
 )
+from playwright.network import serialize_headers
 
 
 class BrowserType(ChannelOwner):
@@ -134,6 +135,8 @@
     ) -> BrowserContext:
         userDataDir = str(Path(userDataDir))
         params = locals_to_params(locals())
+        if extraHTTPHeaders:
+            params["extraHTTPHeaders"] = serialize_headers(extraHTTPHeaders)
         normalize_launch_params(params)
         try:
             return from_channel(

{"golden_diff": "diff --git a/playwright/browser_type.py b/playwright/browser_type.py\n--- a/playwright/browser_type.py\n+++ b/playwright/browser_type.py\n@@ -29,6 +29,7 @@\n     locals_to_params,\n     not_installed_error,\n )\n+from playwright.network import serialize_headers\n \n \n class BrowserType(ChannelOwner):\n@@ -134,6 +135,8 @@\n     ) -> BrowserContext:\n         userDataDir = str(Path(userDataDir))\n         params = locals_to_params(locals())\n+        if extraHTTPHeaders:\n+            params[\"extraHTTPHeaders\"] = serialize_headers(extraHTTPHeaders)\n         normalize_launch_params(params)\n         try:\n             return from_channel(\n", "issue": "Test coverage plan\n- [x] browser\r\n- [x] defaultbrowsercontext wip\r\n\r\n---\r\n- [x] cookies\r\n- [x] emulation\r\n- [x] dispatchevent\r\n- [x] headful\r\n- [x] dialog\r\n- [x] focus\r\n- [x] geolocation\r\n- [x] accessibility\r\n- [x] add_init_script\r\n- [x] browsercontext\r\n- [x] check\r\n- [x] click\r\n- [x] console\r\n- [x] download\r\n- [x] element_handle\r\n- [x] evaluate\r\n- [x] fill\r\n- [x] frames\r\n- [x] generation\r\n- [x] ignore_https_errors\r\n- [x] input\r\n- [x] interception\r\n- [x] jshandle\r\n- [x] keyboard\r\n- [x] launcher\r\n- [x] navigation\r\n- [x] network\r\n- [x] page\r\n- [x] pdf\r\n- [x] popup\r\n- [x] queryselector\r\n- [x] worker\r\n\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\nfrom pathlib import Path\nfrom typing import Dict, List, Union\n\nfrom playwright.browser import Browser\nfrom playwright.browser_context import BrowserContext\nfrom playwright.browser_server import BrowserServer\nfrom playwright.connection import ChannelOwner, from_channel\nfrom playwright.helper import (\n    ColorScheme,\n    Credentials,\n    Env,\n    Geolocation,\n    IntSize,\n    ProxyServer,\n    locals_to_params,\n    not_installed_error,\n)\n\n\nclass BrowserType(ChannelOwner):\n    def __init__(\n        self, parent: ChannelOwner, type: str, guid: str, initializer: Dict\n    ) -> None:\n        super().__init__(parent, type, guid, initializer)\n\n    @property\n    def name(self) -> str:\n        return self._initializer[\"name\"]\n\n    @property\n    def executablePath(self) -> str:\n        return self._initializer[\"executablePath\"]\n\n    async def launch(\n        self,\n        executablePath: str = None,\n        args: List[str] = None,\n        ignoreDefaultArgs: Union[bool, List[str]] = None,\n        handleSIGINT: bool = None,\n        handleSIGTERM: bool = None,\n        handleSIGHUP: bool = None,\n        timeout: int = None,\n        env: Env = None,\n        headless: bool = None,\n        devtools: bool = None,\n        proxy: ProxyServer = None,\n        downloadsPath: str = None,\n        slowMo: int = None,\n        chromiumSandbox: bool = None,\n    ) -> Browser:\n        params = locals_to_params(locals())\n        normalize_launch_params(params)\n        try:\n            return from_channel(await self._channel.send(\"launch\", params))\n        except Exception as e:\n            if f\"{self.name}-\" in str(e):\n                raise not_installed_error(f'\"{self.name}\" browser was not found.')\n            raise e\n\n    async def launchServer(\n        self,\n        executablePath: str = None,\n        args: List[str] = None,\n        ignoreDefaultArgs: Union[bool, List[str]] = None,\n        handleSIGINT: bool = None,\n        handleSIGTERM: bool = None,\n        handleSIGHUP: bool = None,\n        timeout: int = None,\n        env: Env = None,\n        headless: bool = None,\n        devtools: bool = None,\n        proxy: ProxyServer = None,\n        downloadsPath: str = None,\n        port: int = None,\n        chromiumSandbox: bool = None,\n    ) -> BrowserServer:\n        params = locals_to_params(locals())\n        normalize_launch_params(params)\n        try:\n            return from_channel(await self._channel.send(\"launchServer\", params))\n        except Exception as e:\n            if f\"{self.name}-\" in str(e):\n                raise not_installed_error(f'\"{self.name}\" browser was not found.')\n            raise e\n\n    async def launchPersistentContext(\n        self,\n        userDataDir: str,\n        executablePath: str = None,\n        args: List[str] = None,\n        ignoreDefaultArgs: Union[bool, List[str]] = None,\n        handleSIGINT: bool = None,\n        handleSIGTERM: bool = None,\n        handleSIGHUP: bool = None,\n        timeout: int = None,\n        env: Env = None,\n        headless: bool = None,\n        devtools: bool = None,\n        proxy: ProxyServer = None,\n        downloadsPath: str = None,\n        slowMo: int = None,\n        viewport: IntSize = 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: Credentials = None,\n        deviceScaleFactor: int = None,\n        isMobile: bool = None,\n        hasTouch: bool = None,\n        colorScheme: ColorScheme = None,\n        acceptDownloads: bool = None,\n        chromiumSandbox: bool = None,\n    ) -> BrowserContext:\n        userDataDir = str(Path(userDataDir))\n        params = locals_to_params(locals())\n        normalize_launch_params(params)\n        try:\n            return from_channel(\n                await self._channel.send(\"launchPersistentContext\", params)\n            )\n        except Exception as e:\n            if f\"{self.name}-\" in str(e):\n                raise not_installed_error(f'\"{self.name}\" browser was not found.')\n            raise e\n\n    async def connect(\n        self, wsEndpoint: str, slowMo: int = None, timeout: int = None\n    ) -> Browser:\n        return from_channel(\n            await self._channel.send(\"connect\", locals_to_params(locals()))\n        )\n\n\ndef normalize_launch_params(params: Dict) -> None:\n    if \"env\" in params:\n        params[\"env\"] = {name: str(value) for [name, value] in params[\"env\"].items()}\n    if \"ignoreDefaultArgs\" in params:\n        if isinstance(params[\"ignoreDefaultArgs\"], bool):\n            params[\"ignoreAllDefaultArgs\"] = True\n            del params[\"ignoreDefaultArgs\"]\n        params[\"env\"] = {name: str(value) for [name, value] in params[\"env\"].items()}\n", "path": "playwright/browser_type.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\nfrom pathlib import Path\nfrom typing import Dict, List, Union\n\nfrom playwright.browser import Browser\nfrom playwright.browser_context import BrowserContext\nfrom playwright.browser_server import BrowserServer\nfrom playwright.connection import ChannelOwner, from_channel\nfrom playwright.helper import (\n    ColorScheme,\n    Credentials,\n    Env,\n    Geolocation,\n    IntSize,\n    ProxyServer,\n    locals_to_params,\n    not_installed_error,\n)\nfrom playwright.network import serialize_headers\n\n\nclass BrowserType(ChannelOwner):\n    def __init__(\n        self, parent: ChannelOwner, type: str, guid: str, initializer: Dict\n    ) -> None:\n        super().__init__(parent, type, guid, initializer)\n\n    @property\n    def name(self) -> str:\n        return self._initializer[\"name\"]\n\n    @property\n    def executablePath(self) -> str:\n        return self._initializer[\"executablePath\"]\n\n    async def launch(\n        self,\n        executablePath: str = None,\n        args: List[str] = None,\n        ignoreDefaultArgs: Union[bool, List[str]] = None,\n        handleSIGINT: bool = None,\n        handleSIGTERM: bool = None,\n        handleSIGHUP: bool = None,\n        timeout: int = None,\n        env: Env = None,\n        headless: bool = None,\n        devtools: bool = None,\n        proxy: ProxyServer = None,\n        downloadsPath: str = None,\n        slowMo: int = None,\n        chromiumSandbox: bool = None,\n    ) -> Browser:\n        params = locals_to_params(locals())\n        normalize_launch_params(params)\n        try:\n            return from_channel(await self._channel.send(\"launch\", params))\n        except Exception as e:\n            if f\"{self.name}-\" in str(e):\n                raise not_installed_error(f'\"{self.name}\" browser was not found.')\n            raise e\n\n    async def launchServer(\n        self,\n        executablePath: str = None,\n        args: List[str] = None,\n        ignoreDefaultArgs: Union[bool, List[str]] = None,\n        handleSIGINT: bool = None,\n        handleSIGTERM: bool = None,\n        handleSIGHUP: bool = None,\n        timeout: int = None,\n        env: Env = None,\n        headless: bool = None,\n        devtools: bool = None,\n        proxy: ProxyServer = None,\n        downloadsPath: str = None,\n        port: int = None,\n        chromiumSandbox: bool = None,\n    ) -> BrowserServer:\n        params = locals_to_params(locals())\n        normalize_launch_params(params)\n        try:\n            return from_channel(await self._channel.send(\"launchServer\", params))\n        except Exception as e:\n            if f\"{self.name}-\" in str(e):\n                raise not_installed_error(f'\"{self.name}\" browser was not found.')\n            raise e\n\n    async def launchPersistentContext(\n        self,\n        userDataDir: str,\n        executablePath: str = None,\n        args: List[str] = None,\n        ignoreDefaultArgs: Union[bool, List[str]] = None,\n        handleSIGINT: bool = None,\n        handleSIGTERM: bool = None,\n        handleSIGHUP: bool = None,\n        timeout: int = None,\n        env: Env = None,\n        headless: bool = None,\n        devtools: bool = None,\n        proxy: ProxyServer = None,\n        downloadsPath: str = None,\n        slowMo: int = None,\n        viewport: IntSize = 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: Credentials = None,\n        deviceScaleFactor: int = None,\n        isMobile: bool = None,\n        hasTouch: bool = None,\n        colorScheme: ColorScheme = None,\n        acceptDownloads: bool = None,\n        chromiumSandbox: bool = None,\n    ) -> BrowserContext:\n        userDataDir = str(Path(userDataDir))\n        params = locals_to_params(locals())\n        if extraHTTPHeaders:\n            params[\"extraHTTPHeaders\"] = serialize_headers(extraHTTPHeaders)\n        normalize_launch_params(params)\n        try:\n            return from_channel(\n                await self._channel.send(\"launchPersistentContext\", params)\n            )\n        except Exception as e:\n            if f\"{self.name}-\" in str(e):\n                raise not_installed_error(f'\"{self.name}\" browser was not found.')\n            raise e\n\n    async def connect(\n        self, wsEndpoint: str, slowMo: int = None, timeout: int = None\n    ) -> Browser:\n        return from_channel(\n            await self._channel.send(\"connect\", locals_to_params(locals()))\n        )\n\n\ndef normalize_launch_params(params: Dict) -> None:\n    if \"env\" in params:\n        params[\"env\"] = {name: str(value) for [name, value] in params[\"env\"].items()}\n    if \"ignoreDefaultArgs\" in params:\n        if isinstance(params[\"ignoreDefaultArgs\"], bool):\n            params[\"ignoreAllDefaultArgs\"] = True\n            del params[\"ignoreDefaultArgs\"]\n        params[\"env\"] = {name: str(value) for [name, value] in params[\"env\"].items()}\n", "path": "playwright/browser_type.py"}]}