pure-patchright 1.62.3__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 (142) hide show
  1. patchright/__init__.py +5 -0
  2. patchright/__main__.py +18 -0
  3. patchright/_impl/__init__.py +0 -0
  4. patchright/_impl/__pyinstaller/__init__.py +20 -0
  5. patchright/_impl/__pyinstaller/hook-playwright.async_api.py +3 -0
  6. patchright/_impl/__pyinstaller/hook-playwright.sync_api.py +3 -0
  7. patchright/_impl/_api_structures.py +343 -0
  8. patchright/_impl/_artifact.py +46 -0
  9. patchright/_impl/_assertions.py +1014 -0
  10. patchright/_impl/_async_base.py +88 -0
  11. patchright/_impl/_browser.py +267 -0
  12. patchright/_impl/_browser_context.py +759 -0
  13. patchright/_impl/_browser_type.py +336 -0
  14. patchright/_impl/_cdp_session.py +25 -0
  15. patchright/_impl/_clock.py +62 -0
  16. patchright/_impl/_connection.py +686 -0
  17. patchright/_impl/_console_message.py +83 -0
  18. patchright/_impl/_credentials.py +38 -0
  19. patchright/_impl/_debugger.py +37 -0
  20. patchright/_impl/_dialog.py +45 -0
  21. patchright/_impl/_disposable.py +71 -0
  22. patchright/_impl/_download.py +49 -0
  23. patchright/_impl/_driver.py +24 -0
  24. patchright/_impl/_element_handle.py +446 -0
  25. patchright/_impl/_errors.py +46 -0
  26. patchright/_impl/_event_context_manager.py +19 -0
  27. patchright/_impl/_fetch.py +592 -0
  28. patchright/_impl/_file_chooser.py +42 -0
  29. patchright/_impl/_form_data.py +19 -0
  30. patchright/_impl/_frame.py +959 -0
  31. patchright/_impl/_glob.py +47 -0
  32. patchright/_impl/_greenlets.py +35 -0
  33. patchright/_impl/_har_router.py +98 -0
  34. patchright/_impl/_helper.py +551 -0
  35. patchright/_impl/_impl_to_api_mapping.py +141 -0
  36. patchright/_impl/_input.py +85 -0
  37. patchright/_impl/_js_handle.py +297 -0
  38. patchright/_impl/_json_pipe.py +55 -0
  39. patchright/_impl/_local_utils.py +73 -0
  40. patchright/_impl/_locator.py +894 -0
  41. patchright/_impl/_map.py +18 -0
  42. patchright/_impl/_network.py +953 -0
  43. patchright/_impl/_object_factory.py +93 -0
  44. patchright/_impl/_page.py +1601 -0
  45. patchright/_impl/_path_utils.py +13 -0
  46. patchright/_impl/_playwright.py +43 -0
  47. patchright/_impl/_screencast.py +149 -0
  48. patchright/_impl/_selectors.py +48 -0
  49. patchright/_impl/_set_input_files_helpers.py +134 -0
  50. patchright/_impl/_str_utils.py +59 -0
  51. patchright/_impl/_stream.py +31 -0
  52. patchright/_impl/_sync_base.py +130 -0
  53. patchright/_impl/_tracing.py +243 -0
  54. patchright/_impl/_transport.py +151 -0
  55. patchright/_impl/_video.py +41 -0
  56. patchright/_impl/_waiter.py +168 -0
  57. patchright/_impl/_web_error.py +33 -0
  58. patchright/_impl/_web_storage.py +41 -0
  59. patchright/_impl/_writable_stream.py +26 -0
  60. patchright/_repo_version.py +1 -0
  61. patchright/async_api/__init__.py +234 -0
  62. patchright/async_api/_context_manager.py +38 -0
  63. patchright/async_api/_generated.py +23396 -0
  64. patchright/driver/README.md +1 -0
  65. patchright/driver/package/README.md +3 -0
  66. patchright/driver/package/ThirdPartyNotices.txt +13 -0
  67. patchright/driver/package/bin/install_media_pack.ps1 +5 -0
  68. patchright/driver/package/bin/install_webkit_wsl.ps1 +33 -0
  69. patchright/driver/package/bin/reinstall_chrome_beta_linux.sh +42 -0
  70. patchright/driver/package/bin/reinstall_chrome_beta_mac.sh +13 -0
  71. patchright/driver/package/bin/reinstall_chrome_beta_win.ps1 +24 -0
  72. patchright/driver/package/bin/reinstall_chrome_stable_linux.sh +42 -0
  73. patchright/driver/package/bin/reinstall_chrome_stable_mac.sh +12 -0
  74. patchright/driver/package/bin/reinstall_chrome_stable_win.ps1 +24 -0
  75. patchright/driver/package/bin/reinstall_msedge_beta_linux.sh +48 -0
  76. patchright/driver/package/bin/reinstall_msedge_beta_mac.sh +11 -0
  77. patchright/driver/package/bin/reinstall_msedge_beta_win.ps1 +23 -0
  78. patchright/driver/package/bin/reinstall_msedge_dev_linux.sh +48 -0
  79. patchright/driver/package/bin/reinstall_msedge_dev_mac.sh +11 -0
  80. patchright/driver/package/bin/reinstall_msedge_dev_win.ps1 +23 -0
  81. patchright/driver/package/bin/reinstall_msedge_stable_linux.sh +48 -0
  82. patchright/driver/package/bin/reinstall_msedge_stable_mac.sh +11 -0
  83. patchright/driver/package/bin/reinstall_msedge_stable_win.ps1 +24 -0
  84. patchright/driver/package/browsers.json +75 -0
  85. patchright/driver/package/cli.js +21 -0
  86. patchright/driver/package/index.js +17 -0
  87. patchright/driver/package/index.mjs +28 -0
  88. patchright/driver/package/lib/bootstrap.js +88 -0
  89. patchright/driver/package/lib/coreBundle.js +77498 -0
  90. patchright/driver/package/lib/entry/cliDaemon.js +5 -0
  91. patchright/driver/package/lib/entry/dashboardApp.js +3 -0
  92. patchright/driver/package/lib/entry/mcp.js +10 -0
  93. patchright/driver/package/lib/entry/oopBrowserDownload.js +3 -0
  94. patchright/driver/package/lib/package.js +50 -0
  95. patchright/driver/package/lib/server/chromium/appIcon.png +0 -0
  96. patchright/driver/package/lib/server/electron/loader.js +107 -0
  97. patchright/driver/package/lib/serverRegistry.js +7347 -0
  98. patchright/driver/package/lib/serverRegistry.js.LICENSE +354 -0
  99. patchright/driver/package/lib/tools/cli-client/channelSessions.js +141 -0
  100. patchright/driver/package/lib/tools/cli-client/cli.js +6 -0
  101. patchright/driver/package/lib/tools/cli-client/help.json +708 -0
  102. patchright/driver/package/lib/tools/cli-client/minimist.js +128 -0
  103. patchright/driver/package/lib/tools/cli-client/output.js +343 -0
  104. patchright/driver/package/lib/tools/cli-client/program.js +404 -0
  105. patchright/driver/package/lib/tools/cli-client/registry.js +176 -0
  106. patchright/driver/package/lib/tools/cli-client/session.js +258 -0
  107. patchright/driver/package/lib/tools/dashboard/appIcon.png +0 -0
  108. patchright/driver/package/lib/tools/skills/playwright-cli/SKILL.md +420 -0
  109. patchright/driver/package/lib/tools/skills/playwright-cli/references/element-attributes.md +23 -0
  110. patchright/driver/package/lib/tools/skills/playwright-cli/references/playwright-tests.md +39 -0
  111. patchright/driver/package/lib/tools/skills/playwright-cli/references/request-mocking.md +87 -0
  112. patchright/driver/package/lib/tools/skills/playwright-cli/references/running-code.md +241 -0
  113. patchright/driver/package/lib/tools/skills/playwright-cli/references/session-management.md +225 -0
  114. patchright/driver/package/lib/tools/skills/playwright-cli/references/storage-state.md +275 -0
  115. patchright/driver/package/lib/tools/skills/playwright-cli/references/test-generation.md +433 -0
  116. patchright/driver/package/lib/tools/skills/playwright-cli/references/tracing.md +139 -0
  117. patchright/driver/package/lib/tools/skills/playwright-cli/references/video-recording.md +143 -0
  118. patchright/driver/package/lib/tools/skills/playwright-component-testing/SKILL.md +143 -0
  119. patchright/driver/package/lib/tools/skills/playwright-component-testing/references/gallery-spec.md +144 -0
  120. patchright/driver/package/lib/tools/skills/playwright-component-testing/references/migration.md +85 -0
  121. patchright/driver/package/lib/tools/skills/playwright-component-testing/references/react.md +67 -0
  122. patchright/driver/package/lib/tools/skills/playwright-component-testing/references/vue.md +75 -0
  123. patchright/driver/package/lib/tools/skills/playwright-trace/SKILL.md +171 -0
  124. patchright/driver/package/lib/tools/utils/extension.js +101 -0
  125. patchright/driver/package/lib/tools/utils/socketConnection.js +108 -0
  126. patchright/driver/package/lib/utilsBundle.js +90764 -0
  127. patchright/driver/package/lib/utilsBundle.js.LICENSE +2179 -0
  128. patchright/driver/package/lib/webp_codec.LICENSE +173 -0
  129. patchright/driver/package/lib/webp_codec.wasm +0 -0
  130. patchright/driver/package/lib/xdg-open +1267 -0
  131. patchright/driver/package/package.json +34 -0
  132. patchright/py.typed +0 -0
  133. patchright/sync_api/__init__.py +234 -0
  134. patchright/sync_api/_context_manager.py +73 -0
  135. patchright/sync_api/_generated.py +23590 -0
  136. pure_patchright-1.62.3.dist-info/LICENSE +201 -0
  137. pure_patchright-1.62.3.dist-info/METADATA +96 -0
  138. pure_patchright-1.62.3.dist-info/RECORD +142 -0
  139. pure_patchright-1.62.3.dist-info/WHEEL +4 -0
  140. pure_patchright-1.62.3.dist-info/entry_points.txt +5 -0
  141. pure_patchright-1.62.3.dist-info/licenses/LICENSE +202 -0
  142. pure_patchright-1.62.3.dist-info/top_level.txt +1 -0
patchright/__init__.py ADDED
@@ -0,0 +1,5 @@
1
+ """
2
+ Python package `playwright` is a Python library to automate Chromium,
3
+ Firefox and WebKit with a single API. Playwright is built to enable cross-browser
4
+ web automation that is ever-green, capable, reliable and fast.
5
+ """
patchright/__main__.py ADDED
@@ -0,0 +1,18 @@
1
+ import subprocess
2
+ import sys
3
+ from patchright._impl._driver import compute_driver_executable, get_driver_env
4
+
5
+
6
+ def main() -> None:
7
+ try:
8
+ driver_executable, driver_cli = compute_driver_executable()
9
+ completed_process = subprocess.run(
10
+ [driver_executable, driver_cli, *sys.argv[1:]], env=get_driver_env()
11
+ )
12
+ sys.exit(completed_process.returncode)
13
+ except KeyboardInterrupt:
14
+ sys.exit(130)
15
+
16
+
17
+ if __name__ == "__main__":
18
+ 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,3 @@
1
+ from PyInstaller.utils.hooks import collect_data_files
2
+
3
+ datas = collect_data_files("patchright")
@@ -0,0 +1,3 @@
1
+ from PyInstaller.utils.hooks import collect_data_files
2
+
3
+ datas = collect_data_files("patchright")
@@ -0,0 +1,343 @@
1
+ from pathlib import Path
2
+ from typing import Any, Dict, List, Literal, Optional, Sequence, TypedDict, Union
3
+
4
+
5
+ class Cookie(TypedDict, total=False):
6
+ name: str
7
+ value: str
8
+ domain: str
9
+ path: str
10
+ expires: float
11
+ httpOnly: bool
12
+ secure: bool
13
+ sameSite: Literal["Lax", "None", "Strict"]
14
+ partitionKey: Optional[str]
15
+
16
+
17
+ class StorageStateCookie(TypedDict, total=False):
18
+ name: str
19
+ value: str
20
+ domain: str
21
+ path: str
22
+ expires: float
23
+ httpOnly: bool
24
+ secure: bool
25
+ sameSite: Literal["Lax", "None", "Strict"]
26
+
27
+
28
+ class SetCookieParam(TypedDict, total=False):
29
+ name: str
30
+ value: str
31
+ url: Optional[str]
32
+ domain: Optional[str]
33
+ path: Optional[str]
34
+ expires: Optional[float]
35
+ httpOnly: Optional[bool]
36
+ secure: Optional[bool]
37
+ sameSite: Optional[Literal["Lax", "None", "Strict"]]
38
+ partitionKey: Optional[str]
39
+
40
+
41
+ class FloatRect(TypedDict):
42
+ x: float
43
+ y: float
44
+ width: float
45
+ height: float
46
+
47
+
48
+ class Geolocation(TypedDict, total=False):
49
+ latitude: float
50
+ longitude: float
51
+ accuracy: Optional[float]
52
+
53
+
54
+ class HttpCredentials(TypedDict, total=False):
55
+ username: str
56
+ password: str
57
+ origin: Optional[str]
58
+ send: Optional[Literal["always", "unauthorized"]]
59
+
60
+
61
+ class LocalStorageEntry(TypedDict):
62
+ name: str
63
+ value: str
64
+
65
+
66
+ class OriginState(TypedDict):
67
+ origin: str
68
+ localStorage: List[LocalStorageEntry]
69
+
70
+
71
+ class PdfMargins(TypedDict, total=False):
72
+ top: Optional[Union[str, float]]
73
+ right: Optional[Union[str, float]]
74
+ bottom: Optional[Union[str, float]]
75
+ left: Optional[Union[str, float]]
76
+
77
+
78
+ class Position(TypedDict):
79
+ x: float
80
+ y: float
81
+
82
+
83
+ class ProxySettings(TypedDict, total=False):
84
+ server: str
85
+ bypass: Optional[str]
86
+ username: Optional[str]
87
+ password: Optional[str]
88
+
89
+
90
+ class StorageState(TypedDict, total=False):
91
+ cookies: List[StorageStateCookie]
92
+ origins: List[OriginState]
93
+
94
+
95
+ class ClientCertificate(TypedDict, total=False):
96
+ origin: str
97
+ certPath: Optional[Union[str, Path]]
98
+ cert: Optional[bytes]
99
+ keyPath: Optional[Union[str, Path]]
100
+ key: Optional[bytes]
101
+ pfxPath: Optional[Union[str, Path]]
102
+ pfx: Optional[bytes]
103
+ passphrase: Optional[str]
104
+
105
+
106
+ class ResourceTiming(TypedDict):
107
+ startTime: float
108
+ domainLookupStart: float
109
+ domainLookupEnd: float
110
+ connectStart: float
111
+ secureConnectionStart: float
112
+ connectEnd: float
113
+ requestStart: float
114
+ responseStart: float
115
+ responseEnd: float
116
+
117
+
118
+ class RequestSizes(TypedDict):
119
+ requestBodySize: int
120
+ requestHeadersSize: int
121
+ responseBodySize: int
122
+ responseHeadersSize: int
123
+
124
+
125
+ class ViewportSize(TypedDict):
126
+ width: int
127
+ height: int
128
+
129
+
130
+ class SourceLocation(TypedDict):
131
+ url: str
132
+ line: int
133
+ column: int
134
+ lineNumber: int
135
+ columnNumber: int
136
+
137
+
138
+ class WebErrorLocation(TypedDict):
139
+ url: str
140
+ line: int
141
+ column: int
142
+
143
+
144
+ class FilePayload(TypedDict):
145
+ name: str
146
+ mimeType: str
147
+ buffer: bytes
148
+
149
+
150
+ class DropPayload(TypedDict, total=False):
151
+ files: Optional[
152
+ Union[str, Path, FilePayload, Sequence[Union[str, Path]], Sequence[FilePayload]]
153
+ ]
154
+ data: Optional[Dict[str, str]]
155
+
156
+
157
+ class RemoteAddr(TypedDict):
158
+ ipAddress: str
159
+ port: int
160
+
161
+
162
+ class BrowserBindResult(TypedDict):
163
+ endpoint: str
164
+
165
+
166
+ class SecurityDetails(TypedDict):
167
+ issuer: Optional[str]
168
+ protocol: Optional[str]
169
+ subjectName: Optional[str]
170
+ validFrom: Optional[float]
171
+ validTo: Optional[float]
172
+
173
+
174
+ class NameValue(TypedDict):
175
+ name: str
176
+ value: str
177
+
178
+
179
+ HeadersArray = List[NameValue]
180
+ Headers = Dict[str, str]
181
+
182
+
183
+ class ServerFilePayload(TypedDict):
184
+ name: str
185
+ mimeType: str
186
+ buffer: str
187
+
188
+
189
+ class FormField(TypedDict, total=False):
190
+ name: str
191
+ value: Optional[str]
192
+ file: Optional[ServerFilePayload]
193
+
194
+
195
+ class ExpectedTextValue(TypedDict, total=False):
196
+ string: str
197
+ regexSource: str
198
+ regexFlags: str
199
+ matchSubstring: bool
200
+ normalizeWhiteSpace: bool
201
+ ignoreCase: Optional[bool]
202
+
203
+
204
+ class FrameExpectOptions(TypedDict, total=False):
205
+ expressionArg: Any
206
+ expectedText: Optional[Sequence[ExpectedTextValue]]
207
+ expectedNumber: Optional[float]
208
+ expectedValue: Optional[Any]
209
+ useInnerText: Optional[bool]
210
+ isNot: bool
211
+ timeout: Optional[float]
212
+ pseudo: Optional[str]
213
+
214
+
215
+ class FrameExpectResult(TypedDict, total=False):
216
+ matches: bool
217
+ received: Any
218
+ log: Optional[List[str]]
219
+ errorMessage: Optional[str]
220
+ timedOut: Optional[bool]
221
+
222
+
223
+ AriaRole = Literal[
224
+ "alert",
225
+ "alertdialog",
226
+ "application",
227
+ "article",
228
+ "banner",
229
+ "blockquote",
230
+ "button",
231
+ "caption",
232
+ "cell",
233
+ "checkbox",
234
+ "code",
235
+ "columnheader",
236
+ "combobox",
237
+ "complementary",
238
+ "contentinfo",
239
+ "definition",
240
+ "deletion",
241
+ "dialog",
242
+ "directory",
243
+ "document",
244
+ "emphasis",
245
+ "feed",
246
+ "figure",
247
+ "form",
248
+ "generic",
249
+ "grid",
250
+ "gridcell",
251
+ "group",
252
+ "heading",
253
+ "img",
254
+ "insertion",
255
+ "link",
256
+ "list",
257
+ "listbox",
258
+ "listitem",
259
+ "log",
260
+ "main",
261
+ "marquee",
262
+ "math",
263
+ "menu",
264
+ "menubar",
265
+ "menuitem",
266
+ "menuitemcheckbox",
267
+ "menuitemradio",
268
+ "meter",
269
+ "navigation",
270
+ "none",
271
+ "note",
272
+ "option",
273
+ "paragraph",
274
+ "presentation",
275
+ "progressbar",
276
+ "radio",
277
+ "radiogroup",
278
+ "region",
279
+ "row",
280
+ "rowgroup",
281
+ "rowheader",
282
+ "scrollbar",
283
+ "search",
284
+ "searchbox",
285
+ "separator",
286
+ "slider",
287
+ "spinbutton",
288
+ "status",
289
+ "strong",
290
+ "subscript",
291
+ "superscript",
292
+ "switch",
293
+ "tab",
294
+ "table",
295
+ "tablist",
296
+ "tabpanel",
297
+ "term",
298
+ "textbox",
299
+ "time",
300
+ "timer",
301
+ "toolbar",
302
+ "tooltip",
303
+ "tree",
304
+ "treegrid",
305
+ "treeitem",
306
+ ]
307
+
308
+
309
+ class TracingGroupLocation(TypedDict):
310
+ file: str
311
+ line: Optional[int]
312
+ column: Optional[int]
313
+
314
+
315
+ class DebuggerLocation(TypedDict):
316
+ file: str
317
+ line: Optional[int]
318
+ column: Optional[int]
319
+
320
+
321
+ class DebuggerPausedDetails(TypedDict):
322
+ location: DebuggerLocation
323
+ title: str
324
+
325
+
326
+ class ScreencastSize(TypedDict):
327
+ width: int
328
+ height: int
329
+
330
+
331
+ class VirtualCredential(TypedDict):
332
+ id: str
333
+ rpId: str
334
+ userHandle: str
335
+ privateKey: str
336
+ publicKey: str
337
+
338
+
339
+ class ScreencastFrame(TypedDict):
340
+ data: bytes
341
+ timestamp: float
342
+ viewportWidth: int
343
+ viewportHeight: int
@@ -0,0 +1,46 @@
1
+ import pathlib
2
+ from pathlib import Path
3
+ from typing import Dict, Optional, Union, cast
4
+ from patchright._impl._connection import ChannelOwner, from_channel
5
+ from patchright._impl._helper import Error, make_dirs_for_file, patch_error_message
6
+ from patchright._impl._stream import Stream
7
+
8
+
9
+ class Artifact(ChannelOwner):
10
+ def __init__(
11
+ self, parent: ChannelOwner, type: str, guid: str, initializer: Dict
12
+ ) -> None:
13
+ super().__init__(parent, type, guid, initializer)
14
+ self.absolute_path = initializer["absolutePath"]
15
+
16
+ async def path_after_finished(self) -> pathlib.Path:
17
+ if self._connection.is_remote:
18
+ raise Error(
19
+ "Path is not available when using browser_type.connect(). Use save_as() to save a local copy."
20
+ )
21
+ path = await self._channel.send("pathAfterFinished", None)
22
+ return pathlib.Path(path)
23
+
24
+ async def save_as(self, path: Union[str, Path]) -> None:
25
+ stream = cast(
26
+ Stream, from_channel(await self._channel.send("saveAsStream", None))
27
+ )
28
+ make_dirs_for_file(path)
29
+ await stream.save_as(path)
30
+
31
+ async def failure(self) -> Optional[str]:
32
+ reason = await self._channel.send("failure", None)
33
+ if reason is None:
34
+ return None
35
+ return patch_error_message(reason)
36
+
37
+ async def delete(self) -> None:
38
+ await self._channel.send("delete", None)
39
+
40
+ async def read_info_buffer(self) -> bytes:
41
+ stream = cast(Stream, from_channel(await self._channel.send("stream", None)))
42
+ buffer = await stream.read_all()
43
+ return buffer
44
+
45
+ async def cancel(self) -> None:
46
+ await self._channel.send("cancel", None)