playwright-browserstack 1.62.0__py3-none-win_amd64.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 (192) 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/_android.py +704 -0
  8. playwright/_impl/_api_structures.py +365 -0
  9. playwright/_impl/_artifact.py +87 -0
  10. playwright/_impl/_assertions.py +1124 -0
  11. playwright/_impl/_async_base.py +105 -0
  12. playwright/_impl/_browser.py +293 -0
  13. playwright/_impl/_browser_context.py +754 -0
  14. playwright/_impl/_browser_type.py +368 -0
  15. playwright/_impl/_cdp_session.py +46 -0
  16. playwright/_impl/_clock.py +104 -0
  17. playwright/_impl/_connection.py +764 -0
  18. playwright/_impl/_console_message.py +98 -0
  19. playwright/_impl/_credentials.py +57 -0
  20. playwright/_impl/_debugger.py +54 -0
  21. playwright/_impl/_dialog.py +63 -0
  22. playwright/_impl/_disposable.py +96 -0
  23. playwright/_impl/_download.py +64 -0
  24. playwright/_impl/_driver.py +41 -0
  25. playwright/_impl/_element_handle.py +480 -0
  26. playwright/_impl/_errors.py +64 -0
  27. playwright/_impl/_event_context_manager.py +33 -0
  28. playwright/_impl/_fetch.py +626 -0
  29. playwright/_impl/_file_chooser.py +57 -0
  30. playwright/_impl/_form_data.py +34 -0
  31. playwright/_impl/_frame.py +985 -0
  32. playwright/_impl/_glob.py +65 -0
  33. playwright/_impl/_greenlets.py +49 -0
  34. playwright/_impl/_har_router.py +122 -0
  35. playwright/_impl/_helper.py +601 -0
  36. playwright/_impl/_impl_to_api_mapping.py +158 -0
  37. playwright/_impl/_input.py +111 -0
  38. playwright/_impl/_js_handle.py +336 -0
  39. playwright/_impl/_json_pipe.py +97 -0
  40. playwright/_impl/_local_utils.py +95 -0
  41. playwright/_impl/_locator.py +1024 -0
  42. playwright/_impl/_map.py +31 -0
  43. playwright/_impl/_network.py +1017 -0
  44. playwright/_impl/_object_factory.py +116 -0
  45. playwright/_impl/_page.py +1637 -0
  46. playwright/_impl/_path_utils.py +27 -0
  47. playwright/_impl/_playwright.py +68 -0
  48. playwright/_impl/_screencast.py +177 -0
  49. playwright/_impl/_selectors.py +67 -0
  50. playwright/_impl/_set_input_files_helpers.py +158 -0
  51. playwright/_impl/_str_utils.py +76 -0
  52. playwright/_impl/_stream.py +46 -0
  53. playwright/_impl/_sync_base.py +151 -0
  54. playwright/_impl/_tracing.py +281 -0
  55. playwright/_impl/_transport.py +184 -0
  56. playwright/_impl/_video.py +56 -0
  57. playwright/_impl/_waiter.py +197 -0
  58. playwright/_impl/_web_error.py +48 -0
  59. playwright/_impl/_web_storage.py +58 -0
  60. playwright/_impl/_writable_stream.py +42 -0
  61. playwright/_repo_version.py +24 -0
  62. playwright/async_api/__init__.py +275 -0
  63. playwright/async_api/_android_generated.py +462 -0
  64. playwright/async_api/_context_manager.py +57 -0
  65. playwright/async_api/_generated.py +23875 -0
  66. playwright/driver/LICENSE +2946 -0
  67. playwright/driver/README.md +1 -0
  68. playwright/driver/node.exe +0 -0
  69. playwright/driver/package/LICENSE +202 -0
  70. playwright/driver/package/NOTICE +5 -0
  71. playwright/driver/package/README.md +3 -0
  72. playwright/driver/package/ThirdPartyNotices.txt +13 -0
  73. playwright/driver/package/bin/install_media_pack.ps1 +5 -0
  74. playwright/driver/package/bin/install_webkit_wsl.ps1 +33 -0
  75. playwright/driver/package/bin/reinstall_chrome_beta_linux.sh +42 -0
  76. playwright/driver/package/bin/reinstall_chrome_beta_mac.sh +13 -0
  77. playwright/driver/package/bin/reinstall_chrome_beta_win.ps1 +24 -0
  78. playwright/driver/package/bin/reinstall_chrome_stable_linux.sh +42 -0
  79. playwright/driver/package/bin/reinstall_chrome_stable_mac.sh +12 -0
  80. playwright/driver/package/bin/reinstall_chrome_stable_win.ps1 +24 -0
  81. playwright/driver/package/bin/reinstall_msedge_beta_linux.sh +48 -0
  82. playwright/driver/package/bin/reinstall_msedge_beta_mac.sh +11 -0
  83. playwright/driver/package/bin/reinstall_msedge_beta_win.ps1 +23 -0
  84. playwright/driver/package/bin/reinstall_msedge_dev_linux.sh +48 -0
  85. playwright/driver/package/bin/reinstall_msedge_dev_mac.sh +11 -0
  86. playwright/driver/package/bin/reinstall_msedge_dev_win.ps1 +23 -0
  87. playwright/driver/package/bin/reinstall_msedge_stable_linux.sh +48 -0
  88. playwright/driver/package/bin/reinstall_msedge_stable_mac.sh +11 -0
  89. playwright/driver/package/bin/reinstall_msedge_stable_win.ps1 +24 -0
  90. playwright/driver/package/browsers.json +75 -0
  91. playwright/driver/package/cli.js +21 -0
  92. playwright/driver/package/index.d.ts +17 -0
  93. playwright/driver/package/index.js +17 -0
  94. playwright/driver/package/index.mjs +28 -0
  95. playwright/driver/package/lib/bootstrap.js +88 -0
  96. playwright/driver/package/lib/coreBundle.js +74830 -0
  97. playwright/driver/package/lib/entry/cliDaemon.js +5 -0
  98. playwright/driver/package/lib/entry/dashboardApp.js +3 -0
  99. playwright/driver/package/lib/entry/mcp.js +10 -0
  100. playwright/driver/package/lib/entry/oopBrowserDownload.js +3 -0
  101. playwright/driver/package/lib/package.js +50 -0
  102. playwright/driver/package/lib/server/chromium/appIcon.png +0 -0
  103. playwright/driver/package/lib/server/electron/loader.js +118 -0
  104. playwright/driver/package/lib/serverRegistry.js +7347 -0
  105. playwright/driver/package/lib/serverRegistry.js.LICENSE +354 -0
  106. playwright/driver/package/lib/tools/cli-client/channelSessions.js +141 -0
  107. playwright/driver/package/lib/tools/cli-client/cli.js +6 -0
  108. playwright/driver/package/lib/tools/cli-client/help.json +708 -0
  109. playwright/driver/package/lib/tools/cli-client/minimist.js +128 -0
  110. playwright/driver/package/lib/tools/cli-client/output.js +343 -0
  111. playwright/driver/package/lib/tools/cli-client/program.js +404 -0
  112. playwright/driver/package/lib/tools/cli-client/registry.js +176 -0
  113. playwright/driver/package/lib/tools/cli-client/session.js +258 -0
  114. playwright/driver/package/lib/tools/dashboard/appIcon.png +0 -0
  115. playwright/driver/package/lib/tools/skills/playwright-cli/SKILL.md +420 -0
  116. playwright/driver/package/lib/tools/skills/playwright-cli/references/element-attributes.md +23 -0
  117. playwright/driver/package/lib/tools/skills/playwright-cli/references/playwright-tests.md +39 -0
  118. playwright/driver/package/lib/tools/skills/playwright-cli/references/request-mocking.md +87 -0
  119. playwright/driver/package/lib/tools/skills/playwright-cli/references/running-code.md +241 -0
  120. playwright/driver/package/lib/tools/skills/playwright-cli/references/session-management.md +225 -0
  121. playwright/driver/package/lib/tools/skills/playwright-cli/references/storage-state.md +275 -0
  122. playwright/driver/package/lib/tools/skills/playwright-cli/references/test-generation.md +433 -0
  123. playwright/driver/package/lib/tools/skills/playwright-cli/references/tracing.md +139 -0
  124. playwright/driver/package/lib/tools/skills/playwright-cli/references/video-recording.md +143 -0
  125. playwright/driver/package/lib/tools/skills/playwright-component-testing/SKILL.md +143 -0
  126. playwright/driver/package/lib/tools/skills/playwright-component-testing/references/gallery-spec.md +144 -0
  127. playwright/driver/package/lib/tools/skills/playwright-component-testing/references/migration.md +85 -0
  128. playwright/driver/package/lib/tools/skills/playwright-component-testing/references/react.md +67 -0
  129. playwright/driver/package/lib/tools/skills/playwright-component-testing/references/vue.md +75 -0
  130. playwright/driver/package/lib/tools/skills/playwright-trace/SKILL.md +171 -0
  131. playwright/driver/package/lib/tools/utils/extension.js +101 -0
  132. playwright/driver/package/lib/tools/utils/socketConnection.js +108 -0
  133. playwright/driver/package/lib/utilsBundle.js +90764 -0
  134. playwright/driver/package/lib/utilsBundle.js.LICENSE +2179 -0
  135. playwright/driver/package/lib/vite/dashboard/assets/codicon-DCmgc-ay.ttf +0 -0
  136. playwright/driver/package/lib/vite/dashboard/assets/firefox-1bWoP6pv.svg +1 -0
  137. playwright/driver/package/lib/vite/dashboard/assets/firefox-beta-k3eOH_eK.svg +1 -0
  138. playwright/driver/package/lib/vite/dashboard/assets/firefox-nightly-Cp5nfeDT.svg +1 -0
  139. playwright/driver/package/lib/vite/dashboard/assets/index-CyWAfh-p.js +11 -0
  140. playwright/driver/package/lib/vite/dashboard/assets/index-DhC616m4.css +1 -0
  141. playwright/driver/package/lib/vite/dashboard/assets/safari-na3_-uQk.svg +1 -0
  142. playwright/driver/package/lib/vite/dashboard/index.html +29 -0
  143. playwright/driver/package/lib/vite/dashboard/playwright-logo.svg +24 -0
  144. playwright/driver/package/lib/vite/htmlReport/index.html +16 -0
  145. playwright/driver/package/lib/vite/htmlReport/report.css +2 -0
  146. playwright/driver/package/lib/vite/htmlReport/report.js +32 -0
  147. playwright/driver/package/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
  148. playwright/driver/package/lib/vite/recorder/assets/codeMirrorModule-CwYYHbcZ.js +32 -0
  149. playwright/driver/package/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
  150. playwright/driver/package/lib/vite/recorder/assets/index-DYjdXIbE.js +129 -0
  151. playwright/driver/package/lib/vite/recorder/assets/index-l_lX622x.css +1 -0
  152. playwright/driver/package/lib/vite/recorder/index.html +29 -0
  153. playwright/driver/package/lib/vite/recorder/playwright-logo.svg +9 -0
  154. playwright/driver/package/lib/vite/traceViewer/assets/codeMirrorModule-By56iMx7.js +32 -0
  155. playwright/driver/package/lib/vite/traceViewer/assets/defaultSettingsView-B34OrIms.js +181 -0
  156. playwright/driver/package/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
  157. playwright/driver/package/lib/vite/traceViewer/assets/xtermModule-COQkjINf.js +7 -0
  158. playwright/driver/package/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
  159. playwright/driver/package/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
  160. playwright/driver/package/lib/vite/traceViewer/defaultSettingsView.BLFoOugd.css +1 -0
  161. playwright/driver/package/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
  162. playwright/driver/package/lib/vite/traceViewer/index.Dl36UVQT.js +1 -0
  163. playwright/driver/package/lib/vite/traceViewer/index.html +44 -0
  164. playwright/driver/package/lib/vite/traceViewer/manifest.webmanifest +16 -0
  165. playwright/driver/package/lib/vite/traceViewer/playwright-logo.svg +9 -0
  166. playwright/driver/package/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
  167. playwright/driver/package/lib/vite/traceViewer/snapshot.html +10 -0
  168. playwright/driver/package/lib/vite/traceViewer/sw.bundle.js +4 -0
  169. playwright/driver/package/lib/vite/traceViewer/uiMode.C7UW1sC9.css +1 -0
  170. playwright/driver/package/lib/vite/traceViewer/uiMode.D962mr9b.js +5 -0
  171. playwright/driver/package/lib/vite/traceViewer/uiMode.html +18 -0
  172. playwright/driver/package/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
  173. playwright/driver/package/lib/webp_codec.LICENSE +173 -0
  174. playwright/driver/package/lib/webp_codec.wasm +0 -0
  175. playwright/driver/package/lib/xdg-open +1267 -0
  176. playwright/driver/package/package.json +34 -0
  177. playwright/driver/package/types/protocol.d.ts +24842 -0
  178. playwright/driver/package/types/structs.d.ts +47 -0
  179. playwright/driver/package/types/types.d.ts +26188 -0
  180. playwright/py.typed +0 -0
  181. playwright/sync_api/__init__.py +275 -0
  182. playwright/sync_api/_android_generated.py +494 -0
  183. playwright/sync_api/_context_manager.py +98 -0
  184. playwright/sync_api/_generated.py +24045 -0
  185. playwright_browserstack-1.62.0.dist-info/METADATA +82 -0
  186. playwright_browserstack-1.62.0.dist-info/RECORD +192 -0
  187. playwright_browserstack-1.62.0.dist-info/WHEEL +5 -0
  188. playwright_browserstack-1.62.0.dist-info/entry_points.txt +5 -0
  189. playwright_browserstack-1.62.0.dist-info/licenses/LICENSE +202 -0
  190. playwright_browserstack-1.62.0.dist-info/licenses/LICENSE.txt +51 -0
  191. playwright_browserstack-1.62.0.dist-info/licenses/NOTICE +18 -0
  192. playwright_browserstack-1.62.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,365 @@
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 Any, Dict, List, Literal, Optional, Sequence, TypedDict, Union
17
+
18
+ # These are the structures that we like keeping in a JSON form for their potential
19
+ # reuse between SDKs / services. They are public and are a part of the
20
+ # stable API.
21
+
22
+ # Explicitly mark optional params as such for the documentation
23
+ # If there is at least one optional param, set total=False for better mypy handling.
24
+
25
+
26
+ class Cookie(TypedDict, total=False):
27
+ name: str
28
+ value: str
29
+ domain: str
30
+ path: str
31
+ expires: float
32
+ httpOnly: bool
33
+ secure: bool
34
+ sameSite: Literal["Lax", "None", "Strict"]
35
+ partitionKey: Optional[str]
36
+
37
+
38
+ class StorageStateCookie(TypedDict, total=False):
39
+ name: str
40
+ value: str
41
+ domain: str
42
+ path: str
43
+ expires: float
44
+ httpOnly: bool
45
+ secure: bool
46
+ sameSite: Literal["Lax", "None", "Strict"]
47
+
48
+
49
+ # TODO: We are waiting for PEP705 so SetCookieParam can be readonly and matches Cookie.
50
+ class SetCookieParam(TypedDict, total=False):
51
+ name: str
52
+ value: str
53
+ url: Optional[str]
54
+ domain: Optional[str]
55
+ path: Optional[str]
56
+ expires: Optional[float]
57
+ httpOnly: Optional[bool]
58
+ secure: Optional[bool]
59
+ sameSite: Optional[Literal["Lax", "None", "Strict"]]
60
+ partitionKey: Optional[str]
61
+
62
+
63
+ class FloatRect(TypedDict):
64
+ x: float
65
+ y: float
66
+ width: float
67
+ height: float
68
+
69
+
70
+ class Geolocation(TypedDict, total=False):
71
+ latitude: float
72
+ longitude: float
73
+ accuracy: Optional[float]
74
+
75
+
76
+ class HttpCredentials(TypedDict, total=False):
77
+ username: str
78
+ password: str
79
+ origin: Optional[str]
80
+ send: Optional[Literal["always", "unauthorized"]]
81
+
82
+
83
+ class LocalStorageEntry(TypedDict):
84
+ name: str
85
+ value: str
86
+
87
+
88
+ class OriginState(TypedDict):
89
+ origin: str
90
+ localStorage: List[LocalStorageEntry]
91
+
92
+
93
+ class PdfMargins(TypedDict, total=False):
94
+ top: Optional[Union[str, float]]
95
+ right: Optional[Union[str, float]]
96
+ bottom: Optional[Union[str, float]]
97
+ left: Optional[Union[str, float]]
98
+
99
+
100
+ class Position(TypedDict):
101
+ x: float
102
+ y: float
103
+
104
+
105
+ class ProxySettings(TypedDict, total=False):
106
+ server: str
107
+ bypass: Optional[str]
108
+ username: Optional[str]
109
+ password: Optional[str]
110
+
111
+
112
+ class StorageState(TypedDict, total=False):
113
+ cookies: List[StorageStateCookie]
114
+ origins: List[OriginState]
115
+
116
+
117
+ class ClientCertificate(TypedDict, total=False):
118
+ origin: str
119
+ certPath: Optional[Union[str, Path]]
120
+ cert: Optional[bytes]
121
+ keyPath: Optional[Union[str, Path]]
122
+ key: Optional[bytes]
123
+ pfxPath: Optional[Union[str, Path]]
124
+ pfx: Optional[bytes]
125
+ passphrase: Optional[str]
126
+
127
+
128
+ class ResourceTiming(TypedDict):
129
+ startTime: float
130
+ domainLookupStart: float
131
+ domainLookupEnd: float
132
+ connectStart: float
133
+ secureConnectionStart: float
134
+ connectEnd: float
135
+ requestStart: float
136
+ responseStart: float
137
+ responseEnd: float
138
+
139
+
140
+ class RequestSizes(TypedDict):
141
+ requestBodySize: int
142
+ requestHeadersSize: int
143
+ responseBodySize: int
144
+ responseHeadersSize: int
145
+
146
+
147
+ class ViewportSize(TypedDict):
148
+ width: int
149
+ height: int
150
+
151
+
152
+ class SourceLocation(TypedDict):
153
+ url: str
154
+ line: int
155
+ column: int
156
+ lineNumber: int
157
+ columnNumber: int
158
+
159
+
160
+ class WebErrorLocation(TypedDict):
161
+ url: str
162
+ line: int
163
+ column: int
164
+
165
+
166
+ class FilePayload(TypedDict):
167
+ name: str
168
+ mimeType: str
169
+ buffer: bytes
170
+
171
+
172
+ class DropPayload(TypedDict, total=False):
173
+ files: Optional[
174
+ Union[str, Path, FilePayload, Sequence[Union[str, Path]], Sequence[FilePayload]]
175
+ ]
176
+ data: Optional[Dict[str, str]]
177
+
178
+
179
+ class RemoteAddr(TypedDict):
180
+ ipAddress: str
181
+ port: int
182
+
183
+
184
+ class BrowserBindResult(TypedDict):
185
+ endpoint: str
186
+
187
+
188
+ class SecurityDetails(TypedDict):
189
+ issuer: Optional[str]
190
+ protocol: Optional[str]
191
+ subjectName: Optional[str]
192
+ validFrom: Optional[float]
193
+ validTo: Optional[float]
194
+
195
+
196
+ class NameValue(TypedDict):
197
+ name: str
198
+ value: str
199
+
200
+
201
+ HeadersArray = List[NameValue]
202
+ Headers = Dict[str, str]
203
+
204
+
205
+ class ServerFilePayload(TypedDict):
206
+ name: str
207
+ mimeType: str
208
+ buffer: str
209
+
210
+
211
+ class FormField(TypedDict, total=False):
212
+ name: str
213
+ value: Optional[str]
214
+ file: Optional[ServerFilePayload]
215
+
216
+
217
+ class ExpectedTextValue(TypedDict, total=False):
218
+ string: str
219
+ regexSource: str
220
+ regexFlags: str
221
+ matchSubstring: bool
222
+ normalizeWhiteSpace: bool
223
+ ignoreCase: Optional[bool]
224
+
225
+
226
+ class FrameExpectOptions(TypedDict, total=False):
227
+ expressionArg: Any
228
+ expectedText: Optional[Sequence[ExpectedTextValue]]
229
+ expectedNumber: Optional[float]
230
+ expectedValue: Optional[Any]
231
+ useInnerText: Optional[bool]
232
+ isNot: bool
233
+ timeout: Optional[float]
234
+ pseudo: Optional[str]
235
+
236
+
237
+ class FrameExpectResult(TypedDict, total=False):
238
+ matches: bool
239
+ received: Any
240
+ log: Optional[List[str]]
241
+ errorMessage: Optional[str]
242
+ timedOut: Optional[bool]
243
+
244
+
245
+ AriaRole = Literal[
246
+ "alert",
247
+ "alertdialog",
248
+ "application",
249
+ "article",
250
+ "banner",
251
+ "blockquote",
252
+ "button",
253
+ "caption",
254
+ "cell",
255
+ "checkbox",
256
+ "code",
257
+ "columnheader",
258
+ "combobox",
259
+ "complementary",
260
+ "contentinfo",
261
+ "definition",
262
+ "deletion",
263
+ "dialog",
264
+ "directory",
265
+ "document",
266
+ "emphasis",
267
+ "feed",
268
+ "figure",
269
+ "form",
270
+ "generic",
271
+ "grid",
272
+ "gridcell",
273
+ "group",
274
+ "heading",
275
+ "img",
276
+ "insertion",
277
+ "link",
278
+ "list",
279
+ "listbox",
280
+ "listitem",
281
+ "log",
282
+ "main",
283
+ "marquee",
284
+ "math",
285
+ "menu",
286
+ "menubar",
287
+ "menuitem",
288
+ "menuitemcheckbox",
289
+ "menuitemradio",
290
+ "meter",
291
+ "navigation",
292
+ "none",
293
+ "note",
294
+ "option",
295
+ "paragraph",
296
+ "presentation",
297
+ "progressbar",
298
+ "radio",
299
+ "radiogroup",
300
+ "region",
301
+ "row",
302
+ "rowgroup",
303
+ "rowheader",
304
+ "scrollbar",
305
+ "search",
306
+ "searchbox",
307
+ "separator",
308
+ "slider",
309
+ "spinbutton",
310
+ "status",
311
+ "strong",
312
+ "subscript",
313
+ "superscript",
314
+ "switch",
315
+ "tab",
316
+ "table",
317
+ "tablist",
318
+ "tabpanel",
319
+ "term",
320
+ "textbox",
321
+ "time",
322
+ "timer",
323
+ "toolbar",
324
+ "tooltip",
325
+ "tree",
326
+ "treegrid",
327
+ "treeitem",
328
+ ]
329
+
330
+
331
+ class TracingGroupLocation(TypedDict):
332
+ file: str
333
+ line: Optional[int]
334
+ column: Optional[int]
335
+
336
+
337
+ class DebuggerLocation(TypedDict):
338
+ file: str
339
+ line: Optional[int]
340
+ column: Optional[int]
341
+
342
+
343
+ class DebuggerPausedDetails(TypedDict):
344
+ location: DebuggerLocation
345
+ title: str
346
+
347
+
348
+ class ScreencastSize(TypedDict):
349
+ width: int
350
+ height: int
351
+
352
+
353
+ class VirtualCredential(TypedDict):
354
+ id: str
355
+ rpId: str
356
+ userHandle: str
357
+ privateKey: str
358
+ publicKey: str
359
+
360
+
361
+ class ScreencastFrame(TypedDict):
362
+ data: bytes
363
+ timestamp: float
364
+ viewportWidth: int
365
+ viewportHeight: int
@@ -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
+ )