universal-playwright 1.64.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. playwright/__init__.py +19 -0
  2. playwright/__main__.py +33 -0
  3. playwright/_impl/__init__.py +0 -0
  4. playwright/_impl/__pyinstaller/__init__.py +20 -0
  5. playwright/_impl/__pyinstaller/hook-playwright.async_api.py +17 -0
  6. playwright/_impl/__pyinstaller/hook-playwright.sync_api.py +17 -0
  7. playwright/_impl/_api_structures.py +249 -0
  8. playwright/_impl/_artifact.py +87 -0
  9. playwright/_impl/_assertions.py +1125 -0
  10. playwright/_impl/_async_base.py +103 -0
  11. playwright/_impl/_browser.py +296 -0
  12. playwright/_impl/_browser_context.py +750 -0
  13. playwright/_impl/_browser_type.py +380 -0
  14. playwright/_impl/_cdp_session.py +46 -0
  15. playwright/_impl/_clock.py +104 -0
  16. playwright/_impl/_connection.py +768 -0
  17. playwright/_impl/_console_message.py +98 -0
  18. playwright/_impl/_credentials.py +58 -0
  19. playwright/_impl/_debugger.py +54 -0
  20. playwright/_impl/_dialog.py +63 -0
  21. playwright/_impl/_disposable.py +93 -0
  22. playwright/_impl/_download.py +64 -0
  23. playwright/_impl/_driver.py +41 -0
  24. playwright/_impl/_element_handle.py +480 -0
  25. playwright/_impl/_errors.py +64 -0
  26. playwright/_impl/_event_context_manager.py +33 -0
  27. playwright/_impl/_fetch.py +656 -0
  28. playwright/_impl/_file_chooser.py +57 -0
  29. playwright/_impl/_form_data.py +34 -0
  30. playwright/_impl/_frame.py +990 -0
  31. playwright/_impl/_glob.py +65 -0
  32. playwright/_impl/_greenlets.py +94 -0
  33. playwright/_impl/_har_router.py +122 -0
  34. playwright/_impl/_helper.py +616 -0
  35. playwright/_impl/_impl_to_api_mapping.py +159 -0
  36. playwright/_impl/_input.py +111 -0
  37. playwright/_impl/_internal_structures.py +149 -0
  38. playwright/_impl/_js_handle.py +349 -0
  39. playwright/_impl/_json_pipe.py +77 -0
  40. playwright/_impl/_local_utils.py +95 -0
  41. playwright/_impl/_locator.py +1053 -0
  42. playwright/_impl/_map.py +31 -0
  43. playwright/_impl/_network.py +1058 -0
  44. playwright/_impl/_object_factory.py +108 -0
  45. playwright/_impl/_page.py +1661 -0
  46. playwright/_impl/_path_utils.py +27 -0
  47. playwright/_impl/_playwright.py +60 -0
  48. playwright/_impl/_screencast.py +184 -0
  49. playwright/_impl/_selectors.py +67 -0
  50. playwright/_impl/_set_input_files_helpers.py +158 -0
  51. playwright/_impl/_signature.py +32 -0
  52. playwright/_impl/_str_utils.py +93 -0
  53. playwright/_impl/_stream.py +48 -0
  54. playwright/_impl/_sync_base.py +145 -0
  55. playwright/_impl/_tracing.py +287 -0
  56. playwright/_impl/_transport.py +189 -0
  57. playwright/_impl/_video.py +56 -0
  58. playwright/_impl/_waiter.py +197 -0
  59. playwright/_impl/_web_error.py +48 -0
  60. playwright/_impl/_web_storage.py +58 -0
  61. playwright/_impl/_webmcp.py +44 -0
  62. playwright/_impl/_writable_stream.py +42 -0
  63. playwright/_repo_version.py +24 -0
  64. playwright/async_api/__init__.py +268 -0
  65. playwright/async_api/_context_manager.py +57 -0
  66. playwright/async_api/_generated.py +24052 -0
  67. playwright/driver/LICENSE +2946 -0
  68. playwright/driver/README.md +1 -0
  69. playwright/driver/node +39 -0
  70. playwright/driver/node.cmd +3 -0
  71. playwright/driver/package/LICENSE +202 -0
  72. playwright/driver/package/NOTICE +5 -0
  73. playwright/driver/package/README.md +3 -0
  74. playwright/driver/package/ThirdPartyNotices.txt +13 -0
  75. playwright/driver/package/bin/install_media_pack.ps1 +5 -0
  76. playwright/driver/package/bin/install_webkit_wsl.ps1 +33 -0
  77. playwright/driver/package/bin/reinstall_chrome_beta_linux.sh +42 -0
  78. playwright/driver/package/bin/reinstall_chrome_beta_mac.sh +13 -0
  79. playwright/driver/package/bin/reinstall_chrome_beta_win.ps1 +24 -0
  80. playwright/driver/package/bin/reinstall_chrome_stable_linux.sh +42 -0
  81. playwright/driver/package/bin/reinstall_chrome_stable_mac.sh +12 -0
  82. playwright/driver/package/bin/reinstall_chrome_stable_win.ps1 +24 -0
  83. playwright/driver/package/bin/reinstall_msedge_beta_linux.sh +48 -0
  84. playwright/driver/package/bin/reinstall_msedge_beta_mac.sh +11 -0
  85. playwright/driver/package/bin/reinstall_msedge_beta_win.ps1 +23 -0
  86. playwright/driver/package/bin/reinstall_msedge_dev_linux.sh +48 -0
  87. playwright/driver/package/bin/reinstall_msedge_dev_mac.sh +11 -0
  88. playwright/driver/package/bin/reinstall_msedge_dev_win.ps1 +23 -0
  89. playwright/driver/package/bin/reinstall_msedge_stable_linux.sh +48 -0
  90. playwright/driver/package/bin/reinstall_msedge_stable_mac.sh +11 -0
  91. playwright/driver/package/bin/reinstall_msedge_stable_win.ps1 +24 -0
  92. playwright/driver/package/browsers.json +52 -0
  93. playwright/driver/package/cli.js +22 -0
  94. playwright/driver/package/index.d.ts +17 -0
  95. playwright/driver/package/index.js +17 -0
  96. playwright/driver/package/index.mjs +28 -0
  97. playwright/driver/package/lib/bootstrap.js +149 -0
  98. playwright/driver/package/lib/coreBundle.js +78041 -0
  99. playwright/driver/package/lib/entry/cliDaemon.js +5 -0
  100. playwright/driver/package/lib/entry/dashboardApp.js +3 -0
  101. playwright/driver/package/lib/entry/mcp.js +10 -0
  102. playwright/driver/package/lib/entry/oopBrowserDownload.js +3 -0
  103. playwright/driver/package/lib/package.js +50 -0
  104. playwright/driver/package/lib/server/chromium/appIcon.png +0 -0
  105. playwright/driver/package/lib/server/electron/loader.js +123 -0
  106. playwright/driver/package/lib/serverRegistry.js +1939 -0
  107. playwright/driver/package/lib/serverRegistry.js.LICENSE +65 -0
  108. playwright/driver/package/lib/tools/cli-client/channelSessions.js +141 -0
  109. playwright/driver/package/lib/tools/cli-client/cli.js +7 -0
  110. playwright/driver/package/lib/tools/cli-client/help.json +808 -0
  111. playwright/driver/package/lib/tools/cli-client/minimist.js +128 -0
  112. playwright/driver/package/lib/tools/cli-client/output.js +352 -0
  113. playwright/driver/package/lib/tools/cli-client/program.js +422 -0
  114. playwright/driver/package/lib/tools/cli-client/registry.js +180 -0
  115. playwright/driver/package/lib/tools/cli-client/session.js +261 -0
  116. playwright/driver/package/lib/tools/dashboard/appIcon.png +0 -0
  117. playwright/driver/package/lib/tools/skills/playwright-cli/SKILL.md +493 -0
  118. playwright/driver/package/lib/tools/skills/playwright-cli/references/element-attributes.md +23 -0
  119. playwright/driver/package/lib/tools/skills/playwright-cli/references/playwright-tests.md +39 -0
  120. playwright/driver/package/lib/tools/skills/playwright-cli/references/pr-attachments.md +60 -0
  121. playwright/driver/package/lib/tools/skills/playwright-cli/references/request-mocking.md +87 -0
  122. playwright/driver/package/lib/tools/skills/playwright-cli/references/running-code.md +245 -0
  123. playwright/driver/package/lib/tools/skills/playwright-cli/references/session-management.md +227 -0
  124. playwright/driver/package/lib/tools/skills/playwright-cli/references/storage-state.md +275 -0
  125. playwright/driver/package/lib/tools/skills/playwright-cli/references/test-generation.md +433 -0
  126. playwright/driver/package/lib/tools/skills/playwright-cli/references/tracing.md +139 -0
  127. playwright/driver/package/lib/tools/skills/playwright-cli/references/video-recording.md +216 -0
  128. playwright/driver/package/lib/tools/skills/playwright-component-testing/SKILL.md +136 -0
  129. playwright/driver/package/lib/tools/skills/playwright-component-testing/references/gallery-spec.md +144 -0
  130. playwright/driver/package/lib/tools/skills/playwright-component-testing/references/migration.md +89 -0
  131. playwright/driver/package/lib/tools/skills/playwright-component-testing/references/react.md +69 -0
  132. playwright/driver/package/lib/tools/skills/playwright-component-testing/references/typing.md +173 -0
  133. playwright/driver/package/lib/tools/skills/playwright-component-testing/references/vue.md +77 -0
  134. playwright/driver/package/lib/tools/skills/playwright-trace/SKILL.md +174 -0
  135. playwright/driver/package/lib/tools/utils/extension.js +112 -0
  136. playwright/driver/package/lib/tools/utils/socketConnection.js +108 -0
  137. playwright/driver/package/lib/utilsBundle.js +86078 -0
  138. playwright/driver/package/lib/utilsBundle.js.LICENSE +1890 -0
  139. playwright/driver/package/lib/vite/dashboard/assets/codeMirrorModule--QdMvsKi.css +1 -0
  140. playwright/driver/package/lib/vite/dashboard/assets/codeMirrorModule-CQ8RZGBm.js +32 -0
  141. playwright/driver/package/lib/vite/dashboard/assets/codicon-DCmgc-ay.ttf +0 -0
  142. playwright/driver/package/lib/vite/dashboard/assets/firefox-1bWoP6pv.svg +1 -0
  143. playwright/driver/package/lib/vite/dashboard/assets/firefox-beta-k3eOH_eK.svg +1 -0
  144. playwright/driver/package/lib/vite/dashboard/assets/firefox-nightly-Cp5nfeDT.svg +1 -0
  145. playwright/driver/package/lib/vite/dashboard/assets/index-AwgwcYie.css +1 -0
  146. playwright/driver/package/lib/vite/dashboard/assets/index-hRvO4yU2.js +12 -0
  147. playwright/driver/package/lib/vite/dashboard/assets/safari-na3_-uQk.svg +1 -0
  148. playwright/driver/package/lib/vite/dashboard/index.html +29 -0
  149. playwright/driver/package/lib/vite/dashboard/playwright-logo.svg +24 -0
  150. playwright/driver/package/lib/vite/htmlReport/index.html +16 -0
  151. playwright/driver/package/lib/vite/htmlReport/report.css +2 -0
  152. playwright/driver/package/lib/vite/htmlReport/report.js +32 -0
  153. playwright/driver/package/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
  154. playwright/driver/package/lib/vite/recorder/assets/codeMirrorModule-DK72OMRi.js +32 -0
  155. playwright/driver/package/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
  156. playwright/driver/package/lib/vite/recorder/assets/index-BZpYJZ-P.css +1 -0
  157. playwright/driver/package/lib/vite/recorder/assets/index-Cn0mmDuv.js +129 -0
  158. playwright/driver/package/lib/vite/recorder/index.html +29 -0
  159. playwright/driver/package/lib/vite/recorder/playwright-logo.svg +9 -0
  160. playwright/driver/package/lib/vite/traceViewer/assets/codeMirrorModule-BEB2e8M3.js +32 -0
  161. playwright/driver/package/lib/vite/traceViewer/assets/defaultSettingsView-D-g2vrvf.js +184 -0
  162. playwright/driver/package/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
  163. playwright/driver/package/lib/vite/traceViewer/assets/xtermModule-B794rD2Z.js +7 -0
  164. playwright/driver/package/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
  165. playwright/driver/package/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
  166. playwright/driver/package/lib/vite/traceViewer/defaultSettingsView.C8BeHuxd.css +1 -0
  167. playwright/driver/package/lib/vite/traceViewer/index.7-c5LSTW.js +1 -0
  168. playwright/driver/package/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
  169. playwright/driver/package/lib/vite/traceViewer/index.html +44 -0
  170. playwright/driver/package/lib/vite/traceViewer/manifest.webmanifest +16 -0
  171. playwright/driver/package/lib/vite/traceViewer/playwright-logo.svg +9 -0
  172. playwright/driver/package/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
  173. playwright/driver/package/lib/vite/traceViewer/snapshot.html +10 -0
  174. playwright/driver/package/lib/vite/traceViewer/sw.bundle.js +4 -0
  175. playwright/driver/package/lib/vite/traceViewer/uiMode.CYwC_gH1.js +5 -0
  176. playwright/driver/package/lib/vite/traceViewer/uiMode.CyMfwkXJ.css +1 -0
  177. playwright/driver/package/lib/vite/traceViewer/uiMode.html +18 -0
  178. playwright/driver/package/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
  179. playwright/driver/package/lib/webp_codec.LICENSE +173 -0
  180. playwright/driver/package/lib/webp_codec.wasm +0 -0
  181. playwright/driver/package/lib/xdg-open +1267 -0
  182. playwright/driver/package/package.json +34 -0
  183. playwright/driver/package/types/protocol.d.ts +24776 -0
  184. playwright/driver/package/types/structs.d.ts +52 -0
  185. playwright/driver/package/types/types.d.ts +27167 -0
  186. playwright/py.typed +0 -0
  187. playwright/sync_api/__init__.py +268 -0
  188. playwright/sync_api/_context_manager.py +117 -0
  189. playwright/sync_api/_generated.py +24164 -0
  190. universal_playwright-1.64.1.dist-info/METADATA +92 -0
  191. universal_playwright-1.64.1.dist-info/RECORD +195 -0
  192. universal_playwright-1.64.1.dist-info/WHEEL +5 -0
  193. universal_playwright-1.64.1.dist-info/entry_points.txt +5 -0
  194. universal_playwright-1.64.1.dist-info/licenses/LICENSE +202 -0
  195. universal_playwright-1.64.1.dist-info/top_level.txt +1 -0
playwright/__init__.py ADDED
@@ -0,0 +1,19 @@
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
+ """
16
+ Python package `playwright` is a Python library to automate Chromium,
17
+ Firefox and WebKit with a single API. Playwright is built to enable cross-browser
18
+ web automation that is ever-green, capable, reliable and fast.
19
+ """
playwright/__main__.py ADDED
@@ -0,0 +1,33 @@
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 subprocess
16
+ import sys
17
+
18
+ from playwright._impl._driver import compute_driver_executable, get_driver_env
19
+
20
+
21
+ def main() -> None:
22
+ try:
23
+ driver_executable, driver_cli = compute_driver_executable()
24
+ completed_process = subprocess.run(
25
+ [driver_executable, driver_cli, *sys.argv[1:]], env=get_driver_env()
26
+ )
27
+ sys.exit(completed_process.returncode)
28
+ except KeyboardInterrupt:
29
+ sys.exit(130)
30
+
31
+
32
+ if __name__ == "__main__":
33
+ main()
File without changes
@@ -0,0 +1,20 @@
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 os
16
+ from typing import List
17
+
18
+
19
+ def get_hook_dirs() -> List[str]:
20
+ return [os.path.dirname(__file__)]
@@ -0,0 +1,17 @@
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 PyInstaller.utils.hooks import collect_data_files # type: ignore
16
+
17
+ datas = collect_data_files("playwright")
@@ -0,0 +1,17 @@
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 PyInstaller.utils.hooks import collect_data_files # type: ignore
16
+
17
+ datas = collect_data_files("playwright")
@@ -0,0 +1,249 @@
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
+ # Generated from the docs by scripts/codegen/generate_api.js. Do not edit.
16
+
17
+ from pathlib import Path
18
+ from typing import Any, Dict, List, Literal, Optional, Sequence, TypedDict, Union
19
+
20
+
21
+ class BrowserBindResult(TypedDict):
22
+ endpoint: str
23
+
24
+
25
+ class ClientCertificate(TypedDict, total=False):
26
+ origin: str
27
+ certPath: Optional[Union[str, Path]]
28
+ cert: Optional[bytes]
29
+ keyPath: Optional[Union[str, Path]]
30
+ key: Optional[bytes]
31
+ pfxPath: Optional[Union[str, Path]]
32
+ pfx: Optional[bytes]
33
+ passphrase: Optional[str]
34
+
35
+
36
+ class Cookie(TypedDict, total=False):
37
+ name: str
38
+ value: str
39
+ domain: str
40
+ path: str
41
+ expires: float
42
+ httpOnly: bool
43
+ secure: bool
44
+ sameSite: Literal["Lax", "None", "Strict"]
45
+ partitionKey: Optional[str]
46
+
47
+
48
+ class DebuggerLocation(TypedDict):
49
+ file: str
50
+ line: Optional[int]
51
+ column: Optional[int]
52
+
53
+
54
+ class DebuggerPausedDetails(TypedDict):
55
+ location: DebuggerLocation
56
+ title: str
57
+
58
+
59
+ class FilePayload(TypedDict):
60
+ name: str
61
+ mimeType: str
62
+ buffer: bytes
63
+
64
+
65
+ class DropPayload(TypedDict, total=False):
66
+ files: Optional[
67
+ Union[str, Path, Sequence[Union[str, Path]], FilePayload, Sequence[FilePayload]]
68
+ ]
69
+ data: Optional[Dict[str, str]]
70
+
71
+
72
+ class FloatRect(TypedDict):
73
+ x: float
74
+ y: float
75
+ width: float
76
+ height: float
77
+
78
+
79
+ class Geolocation(TypedDict, total=False):
80
+ latitude: float
81
+ longitude: float
82
+ accuracy: Optional[float]
83
+
84
+
85
+ class HttpCredentials(TypedDict, total=False):
86
+ username: str
87
+ password: str
88
+ origin: Optional[str]
89
+ send: Optional[Literal["always", "unauthorized"]]
90
+
91
+
92
+ class LocalStorageEntry(TypedDict):
93
+ name: str
94
+ value: str
95
+
96
+
97
+ class NameValue(TypedDict):
98
+ name: str
99
+ value: str
100
+
101
+
102
+ class OriginState(TypedDict):
103
+ origin: str
104
+ localStorage: List[LocalStorageEntry]
105
+
106
+
107
+ class PdfMargins(TypedDict, total=False):
108
+ top: Optional[Union[str, float]]
109
+ right: Optional[Union[str, float]]
110
+ bottom: Optional[Union[str, float]]
111
+ left: Optional[Union[str, float]]
112
+
113
+
114
+ class Position(TypedDict):
115
+ x: float
116
+ y: float
117
+
118
+
119
+ class ProxySettings(TypedDict, total=False):
120
+ server: str
121
+ bypass: Optional[str]
122
+ username: Optional[str]
123
+ password: Optional[str]
124
+
125
+
126
+ class RemoteAddr(TypedDict):
127
+ ipAddress: str
128
+ port: int
129
+
130
+
131
+ class RequestSizes(TypedDict):
132
+ requestBodySize: int
133
+ requestHeadersSize: int
134
+ responseBodySize: int
135
+ responseHeadersSize: int
136
+
137
+
138
+ class ResourceTiming(TypedDict):
139
+ startTime: float
140
+ domainLookupStart: float
141
+ domainLookupEnd: float
142
+ connectStart: float
143
+ secureConnectionStart: float
144
+ connectEnd: float
145
+ requestStart: float
146
+ responseStart: float
147
+ responseEnd: float
148
+
149
+
150
+ class ScreencastActionStyle(TypedDict, total=False):
151
+ point: Optional[str]
152
+ highlight: Optional[str]
153
+ title: Optional[str]
154
+
155
+
156
+ class ScreencastFrame(TypedDict):
157
+ data: bytes
158
+ timestamp: float
159
+ viewportWidth: int
160
+ viewportHeight: int
161
+
162
+
163
+ class ScreencastSize(TypedDict):
164
+ width: int
165
+ height: int
166
+
167
+
168
+ class SecurityDetails(TypedDict):
169
+ issuer: Optional[str]
170
+ protocol: Optional[str]
171
+ subjectName: Optional[str]
172
+ validFrom: Optional[float]
173
+ validTo: Optional[float]
174
+
175
+
176
+ class SetCookieParam(TypedDict, total=False):
177
+ name: str
178
+ value: str
179
+ url: Optional[str]
180
+ domain: Optional[str]
181
+ path: Optional[str]
182
+ expires: Optional[float]
183
+ httpOnly: Optional[bool]
184
+ secure: Optional[bool]
185
+ sameSite: Optional[Literal["Lax", "None", "Strict"]]
186
+ partitionKey: Optional[str]
187
+
188
+
189
+ class SourceLocation(TypedDict):
190
+ url: str
191
+ line: int
192
+ column: int
193
+ lineNumber: int
194
+ columnNumber: int
195
+
196
+
197
+ class StorageStateCookie(TypedDict, total=False):
198
+ name: str
199
+ value: str
200
+ domain: str
201
+ path: str
202
+ expires: float
203
+ httpOnly: bool
204
+ secure: bool
205
+ sameSite: Literal["Lax", "None", "Strict"]
206
+
207
+
208
+ class StorageState(TypedDict, total=False):
209
+ cookies: List[StorageStateCookie]
210
+ origins: List[OriginState]
211
+
212
+
213
+ class TracingGroupLocation(TypedDict):
214
+ file: str
215
+ line: Optional[int]
216
+ column: Optional[int]
217
+
218
+
219
+ class ViewportSize(TypedDict):
220
+ width: int
221
+ height: int
222
+
223
+
224
+ class VirtualCredential(TypedDict):
225
+ id: str
226
+ rpId: str
227
+ userHandle: str
228
+ privateKey: str
229
+ publicKey: str
230
+ signCount: int
231
+
232
+
233
+ class WebErrorLocation(TypedDict):
234
+ url: str
235
+ line: int
236
+ column: int
237
+
238
+
239
+ class WebMCPToolAnnotations(TypedDict, total=False):
240
+ readOnly: Optional[bool]
241
+ untrustedContent: Optional[bool]
242
+ consequential: Optional[bool]
243
+
244
+
245
+ class WebMCPTool(TypedDict, total=False):
246
+ name: str
247
+ description: str
248
+ inputSchema: Optional[Any]
249
+ annotations: Optional[WebMCPToolAnnotations]
@@ -0,0 +1,87 @@
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 pathlib
16
+ from pathlib import Path
17
+ from typing import Dict, Optional, Union, cast
18
+
19
+ from playwright._impl._connection import ChannelOwner, from_channel
20
+ from playwright._impl._helper import Error, make_dirs_for_file, patch_error_message
21
+ from playwright._impl._stream import Stream
22
+
23
+
24
+ class Artifact(ChannelOwner):
25
+ def __init__(
26
+ self, parent: ChannelOwner, type: str, guid: str, initializer: Dict
27
+ ) -> None:
28
+ super().__init__(parent, type, guid, initializer)
29
+ self.absolute_path = initializer["absolutePath"]
30
+
31
+ async def path_after_finished(self) -> pathlib.Path:
32
+ if self._connection.is_remote:
33
+ raise Error(
34
+ "Path is not available when using browser_type.connect(). Use save_as() to save a local copy."
35
+ )
36
+ path = await self._channel.send(
37
+ "pathAfterFinished",
38
+ None,
39
+ )
40
+ return pathlib.Path(path)
41
+
42
+ async def save_as(self, path: Union[str, Path]) -> None:
43
+ stream = cast(
44
+ Stream,
45
+ from_channel(
46
+ await self._channel.send(
47
+ "saveAsStream",
48
+ None,
49
+ )
50
+ ),
51
+ )
52
+ make_dirs_for_file(path)
53
+ await stream.save_as(path)
54
+
55
+ async def failure(self) -> Optional[str]:
56
+ reason = await self._channel.send(
57
+ "failure",
58
+ None,
59
+ )
60
+ if reason is None:
61
+ return None
62
+ return patch_error_message(reason)
63
+
64
+ async def delete(self) -> None:
65
+ await self._channel.send(
66
+ "delete",
67
+ None,
68
+ )
69
+
70
+ async def read_info_buffer(self) -> bytes:
71
+ stream = cast(
72
+ Stream,
73
+ from_channel(
74
+ await self._channel.send(
75
+ "stream",
76
+ None,
77
+ )
78
+ ),
79
+ )
80
+ buffer = await stream.read_all()
81
+ return buffer
82
+
83
+ async def cancel(self) -> None: # pyright: ignore[reportIncompatibleMethodOverride]
84
+ await self._channel.send(
85
+ "cancel",
86
+ None,
87
+ )