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
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "patchright-core",
3
+ "version": "1.62.3",
4
+ "description": "A high-level API to automate web browsers",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/Kaliiiiiiiiii-Vinyzu/patchright"
8
+ },
9
+ "homepage": "https://github.com/Kaliiiiiiiiii-Vinyzu/patchright",
10
+ "engines": {
11
+ "node": ">=20"
12
+ },
13
+ "author": {
14
+ "name": "Microsoft Corportation, patched by github.com/Kaliiiiiiiiii-Vinyzu/"
15
+ },
16
+ "license": "Apache-2.0",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./index.d.ts",
20
+ "import": "./index.mjs",
21
+ "require": "./index.js",
22
+ "default": "./index.js"
23
+ },
24
+ "./package.json": "./package.json",
25
+ "./lib/bootstrap": "./lib/bootstrap.js",
26
+ "./lib/coreBundle": "./lib/coreBundle.js",
27
+ "./lib/utilsBundle": "./lib/utilsBundle.js",
28
+ "./lib/tools/cli-client/program": "./lib/tools/cli-client/program.js"
29
+ },
30
+ "bin": {
31
+ "patchright-core": "cli.js"
32
+ },
33
+ "types": "types/types.d.ts"
34
+ }
patchright/py.typed ADDED
File without changes
@@ -0,0 +1,234 @@
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
+ """
6
+
7
+ from typing import Any, Optional, Union, overload
8
+ import patchright._impl._api_structures
9
+ import patchright._impl._errors
10
+ import patchright._impl._form_data
11
+ import patchright.sync_api._generated
12
+ from patchright._impl._assertions import (
13
+ APIResponseAssertions as APIResponseAssertionsImpl,
14
+ )
15
+ from patchright._impl._assertions import LocatorAssertions as LocatorAssertionsImpl
16
+ from patchright._impl._assertions import PageAssertions as PageAssertionsImpl
17
+ from patchright.sync_api._context_manager import PlaywrightContextManager
18
+ from patchright.sync_api._generated import (
19
+ APIRequest,
20
+ APIRequestContext,
21
+ APIResponse,
22
+ APIResponseAssertions,
23
+ Browser,
24
+ BrowserContext,
25
+ BrowserType,
26
+ CDPSession,
27
+ ConsoleMessage,
28
+ Dialog,
29
+ Download,
30
+ ElementHandle,
31
+ FileChooser,
32
+ Frame,
33
+ FrameLocator,
34
+ JSHandle,
35
+ Keyboard,
36
+ Locator,
37
+ LocatorAssertions,
38
+ Mouse,
39
+ Page,
40
+ PageAssertions,
41
+ Playwright,
42
+ Request,
43
+ Response,
44
+ Route,
45
+ Selectors,
46
+ Touchscreen,
47
+ Video,
48
+ WebError,
49
+ WebSocket,
50
+ WebSocketRoute,
51
+ Worker,
52
+ )
53
+
54
+ ChromiumBrowserContext = BrowserContext
55
+ Cookie = patchright._impl._api_structures.Cookie
56
+ FilePayload = patchright._impl._api_structures.FilePayload
57
+ FormData = patchright._impl._form_data.FormData
58
+ FloatRect = patchright._impl._api_structures.FloatRect
59
+ Geolocation = patchright._impl._api_structures.Geolocation
60
+ HttpCredentials = patchright._impl._api_structures.HttpCredentials
61
+ BrowserBindResult = patchright._impl._api_structures.BrowserBindResult
62
+ DebuggerLocation = patchright._impl._api_structures.DebuggerLocation
63
+ DebuggerPausedDetails = patchright._impl._api_structures.DebuggerPausedDetails
64
+ PdfMargins = patchright._impl._api_structures.PdfMargins
65
+ Position = patchright._impl._api_structures.Position
66
+ ProxySettings = patchright._impl._api_structures.ProxySettings
67
+ ResourceTiming = patchright._impl._api_structures.ResourceTiming
68
+ ScreencastFrame = patchright._impl._api_structures.ScreencastFrame
69
+ ScreencastSize = patchright._impl._api_structures.ScreencastSize
70
+ SourceLocation = patchright._impl._api_structures.SourceLocation
71
+ StorageState = patchright._impl._api_structures.StorageState
72
+ StorageStateCookie = patchright._impl._api_structures.StorageStateCookie
73
+ ViewportSize = patchright._impl._api_structures.ViewportSize
74
+ VirtualCredential = patchright._impl._api_structures.VirtualCredential
75
+ Error = patchright._impl._errors.Error
76
+ TimeoutError = patchright._impl._errors.TimeoutError
77
+
78
+
79
+ def sync_playwright() -> PlaywrightContextManager:
80
+ return PlaywrightContextManager()
81
+
82
+
83
+ class Expect:
84
+ _unset: Any = object()
85
+
86
+ def __init__(self) -> None:
87
+ self._timeout: Optional[float] = None
88
+
89
+ def set_options(self, timeout: Optional[float] = _unset) -> None:
90
+ """
91
+ This method sets global `expect()` options.
92
+
93
+ Args:
94
+ timeout (float): Timeout value in milliseconds. Default to 5000 milliseconds.
95
+
96
+ Returns:
97
+ None
98
+ """
99
+ if timeout is not self._unset:
100
+ self._timeout = timeout
101
+
102
+ @overload
103
+ def __call__(
104
+ self, actual: Page, message: Optional[str] = None
105
+ ) -> PageAssertions: ...
106
+
107
+ @overload
108
+ def __call__(
109
+ self, actual: Locator, message: Optional[str] = None
110
+ ) -> LocatorAssertions: ...
111
+
112
+ @overload
113
+ def __call__(
114
+ self, actual: APIResponse, message: Optional[str] = None
115
+ ) -> APIResponseAssertions: ...
116
+
117
+ def __call__(
118
+ self, actual: Union[Page, Locator, APIResponse], message: Optional[str] = None
119
+ ) -> Union[PageAssertions, LocatorAssertions, APIResponseAssertions]:
120
+ return self._dispatch(actual, message, is_soft=False)
121
+
122
+ @overload
123
+ def soft(self, actual: Page, message: Optional[str] = None) -> PageAssertions: ...
124
+
125
+ @overload
126
+ def soft(
127
+ self, actual: Locator, message: Optional[str] = None
128
+ ) -> LocatorAssertions: ...
129
+
130
+ @overload
131
+ def soft(
132
+ self, actual: APIResponse, message: Optional[str] = None
133
+ ) -> APIResponseAssertions: ...
134
+
135
+ def soft(
136
+ self, actual: Union[Page, Locator, APIResponse], message: Optional[str] = None
137
+ ) -> Union[PageAssertions, LocatorAssertions, APIResponseAssertions]:
138
+ """
139
+ Creates a [soft assertion](https://playwright.dev/python/docs/test-assertions#soft-assertions).
140
+ Failing soft assertions do not abort test execution, but mark the test
141
+ as failed. Multiple failures from the same test are surfaced together
142
+ at the end of the test.
143
+
144
+ Requires the [pytest-playwright](https://pypi.org/project/pytest-playwright/)
145
+ plugin to establish the per-test scope that collects soft assertion
146
+ failures.
147
+ """
148
+ return self._dispatch(actual, message, is_soft=True)
149
+
150
+ def _dispatch(
151
+ self,
152
+ actual: Union[Page, Locator, APIResponse],
153
+ message: Optional[str],
154
+ is_soft: bool,
155
+ ) -> Union[PageAssertions, LocatorAssertions, APIResponseAssertions]:
156
+ if isinstance(actual, Page):
157
+ return PageAssertions(
158
+ PageAssertionsImpl(
159
+ actual._impl_obj, self._timeout, message=message, is_soft=is_soft
160
+ )
161
+ )
162
+ elif isinstance(actual, Locator):
163
+ return LocatorAssertions(
164
+ LocatorAssertionsImpl(
165
+ actual._impl_obj, self._timeout, message=message, is_soft=is_soft
166
+ )
167
+ )
168
+ elif isinstance(actual, APIResponse):
169
+ return APIResponseAssertions(
170
+ APIResponseAssertionsImpl(
171
+ actual._impl_obj, self._timeout, message=message, is_soft=is_soft
172
+ )
173
+ )
174
+ raise ValueError(f"Unsupported type: {type(actual)}")
175
+
176
+
177
+ expect = Expect()
178
+ __all__ = [
179
+ "expect",
180
+ "APIRequest",
181
+ "APIRequestContext",
182
+ "APIResponse",
183
+ "Browser",
184
+ "BrowserBindResult",
185
+ "BrowserContext",
186
+ "BrowserType",
187
+ "CDPSession",
188
+ "ChromiumBrowserContext",
189
+ "ConsoleMessage",
190
+ "Cookie",
191
+ "Dialog",
192
+ "Download",
193
+ "ElementHandle",
194
+ "Error",
195
+ "FileChooser",
196
+ "FilePayload",
197
+ "FloatRect",
198
+ "FormData",
199
+ "Frame",
200
+ "FrameLocator",
201
+ "Geolocation",
202
+ "HttpCredentials",
203
+ "JSHandle",
204
+ "Keyboard",
205
+ "Locator",
206
+ "Mouse",
207
+ "DebuggerLocation",
208
+ "DebuggerPausedDetails",
209
+ "Page",
210
+ "PdfMargins",
211
+ "Position",
212
+ "Playwright",
213
+ "ProxySettings",
214
+ "Request",
215
+ "ResourceTiming",
216
+ "Response",
217
+ "Route",
218
+ "ScreencastFrame",
219
+ "ScreencastSize",
220
+ "Selectors",
221
+ "SourceLocation",
222
+ "StorageState",
223
+ "StorageStateCookie",
224
+ "sync_playwright",
225
+ "TimeoutError",
226
+ "Touchscreen",
227
+ "Video",
228
+ "ViewportSize",
229
+ "VirtualCredential",
230
+ "WebError",
231
+ "WebSocket",
232
+ "WebSocketRoute",
233
+ "Worker",
234
+ ]
@@ -0,0 +1,73 @@
1
+ import asyncio
2
+ from typing import TYPE_CHECKING, Any, Optional, cast
3
+ from greenlet import greenlet
4
+ from patchright._impl._connection import ChannelOwner, Connection
5
+ from patchright._impl._errors import Error
6
+ from patchright._impl._greenlets import MainGreenlet
7
+ from patchright._impl._object_factory import create_remote_object
8
+ from patchright._impl._playwright import Playwright
9
+ from patchright._impl._transport import PipeTransport
10
+ from patchright.sync_api._generated import Playwright as SyncPlaywright
11
+
12
+ if TYPE_CHECKING:
13
+ from asyncio.unix_events import AbstractChildWatcher
14
+
15
+
16
+ class PlaywrightContextManager:
17
+ def __init__(self) -> None:
18
+ self._playwright: SyncPlaywright
19
+ self._loop: asyncio.AbstractEventLoop
20
+ self._own_loop = False
21
+ self._watcher: Optional[AbstractChildWatcher] = None
22
+ self._exit_was_called = False
23
+
24
+ def __enter__(self) -> SyncPlaywright:
25
+ try:
26
+ self._loop = asyncio.get_running_loop()
27
+ except RuntimeError:
28
+ self._loop = asyncio.new_event_loop()
29
+ self._own_loop = True
30
+ if self._loop.is_running():
31
+ raise Error(
32
+ "It looks like you are using Playwright Sync API inside the asyncio loop.\nPlease use the Async API instead."
33
+ )
34
+
35
+ def greenlet_main() -> None:
36
+ self._loop.run_until_complete(self._connection.run_as_sync())
37
+
38
+ dispatcher_fiber = MainGreenlet(greenlet_main)
39
+ self._connection = Connection(
40
+ dispatcher_fiber,
41
+ create_remote_object,
42
+ PipeTransport(self._loop),
43
+ self._loop,
44
+ )
45
+ g_self = greenlet.getcurrent()
46
+
47
+ def callback_wrapper(channel_owner: ChannelOwner) -> None:
48
+ playwright_impl = cast(Playwright, channel_owner)
49
+ self._playwright = SyncPlaywright(playwright_impl)
50
+ g_self.switch()
51
+
52
+ self._connection.call_on_object_with_known_name("Playwright", callback_wrapper)
53
+ dispatcher_fiber.switch()
54
+ playwright = self._playwright
55
+ playwright.stop = self.__exit__
56
+ return playwright
57
+
58
+ def start(self) -> SyncPlaywright:
59
+ return self.__enter__()
60
+
61
+ def __exit__(self, *args: Any) -> None:
62
+ if self._exit_was_called:
63
+ return
64
+ self._exit_was_called = True
65
+ self._connection.stop_sync()
66
+ if self._watcher:
67
+ self._watcher.close()
68
+ if self._own_loop:
69
+ tasks = asyncio.all_tasks(self._loop)
70
+ for t in [t for t in tasks if not (t.done() or t.cancelled())]:
71
+ t.cancel()
72
+ self._loop.run_until_complete(self._loop.shutdown_asyncgens())
73
+ self._loop.close()