|
15 | 15 | import sys |
16 | 16 | import typing |
17 | 17 |
|
18 | | -from playwright.sync_base import SyncBase |
| 18 | +from playwright.sync_base import SyncBase, mapping |
19 | 19 |
|
20 | 20 | if sys.version_info >= (3, 8): # pragma: no cover |
21 | 21 | from typing import Literal |
@@ -128,6 +128,9 @@ def isNavigationRequest(self) -> bool: |
128 | 128 | return self._sync(self._async_obj.isNavigationRequest()) |
129 | 129 |
|
130 | 130 |
|
| 131 | +mapping.register(RequestAsync, Request) |
| 132 | + |
| 133 | + |
131 | 134 | class Response(SyncBase): |
132 | 135 | def __init__(self, obj: ResponseAsync): |
133 | 136 | super().__init__(obj) |
@@ -200,6 +203,9 @@ def json(self) -> typing.Union[typing.Dict, typing.List]: |
200 | 203 | return self._sync(self._async_obj.json()) |
201 | 204 |
|
202 | 205 |
|
| 206 | +mapping.register(ResponseAsync, Response) |
| 207 | + |
| 208 | + |
203 | 209 | class Route(SyncBase): |
204 | 210 | def __init__(self, obj: RouteAsync): |
205 | 211 | super().__init__(obj) |
@@ -258,6 +264,9 @@ def continue_( |
258 | 264 | ) |
259 | 265 |
|
260 | 266 |
|
| 267 | +mapping.register(RouteAsync, Route) |
| 268 | + |
| 269 | + |
261 | 270 | class Keyboard(SyncBase): |
262 | 271 | def __init__(self, obj: KeyboardAsync): |
263 | 272 | super().__init__(obj) |
@@ -305,6 +314,9 @@ def press(self, key: str, delay: int = None) -> NoneType: |
305 | 314 | return self._sync(self._async_obj.press(key=key, delay=delay)) |
306 | 315 |
|
307 | 316 |
|
| 317 | +mapping.register(KeyboardAsync, Keyboard) |
| 318 | + |
| 319 | + |
308 | 320 | class Mouse(SyncBase): |
309 | 321 | def __init__(self, obj: MouseAsync): |
310 | 322 | super().__init__(obj) |
@@ -371,6 +383,9 @@ def dblclick( |
371 | 383 | ) |
372 | 384 |
|
373 | 385 |
|
| 386 | +mapping.register(MouseAsync, Mouse) |
| 387 | + |
| 388 | + |
374 | 389 | class JSHandle(SyncBase): |
375 | 390 | def __init__(self, obj: JSHandleAsync): |
376 | 391 | super().__init__(obj) |
@@ -440,6 +455,9 @@ def jsonValue(self) -> typing.Any: |
440 | 455 | return self._sync(self._async_obj.jsonValue()) |
441 | 456 |
|
442 | 457 |
|
| 458 | +mapping.register(JSHandleAsync, JSHandle) |
| 459 | + |
| 460 | + |
443 | 461 | class ElementHandle(SyncBase): |
444 | 462 | def __init__(self, obj: ElementHandleAsync): |
445 | 463 | super().__init__(obj) |
@@ -707,6 +725,9 @@ def evalOnSelectorAll( |
707 | 725 | ) |
708 | 726 |
|
709 | 727 |
|
| 728 | +mapping.register(ElementHandleAsync, ElementHandle) |
| 729 | + |
| 730 | + |
710 | 731 | class Accessibility(SyncBase): |
711 | 732 | def __init__(self, obj: AccessibilityAsync): |
712 | 733 | super().__init__(obj) |
@@ -746,6 +767,9 @@ def snapshot( |
746 | 767 | ) |
747 | 768 |
|
748 | 769 |
|
| 770 | +mapping.register(AccessibilityAsync, Accessibility) |
| 771 | + |
| 772 | + |
749 | 773 | class Frame(SyncBase): |
750 | 774 | def __init__(self, obj: FrameAsync): |
751 | 775 | super().__init__(obj) |
@@ -1174,6 +1198,9 @@ def title(self) -> str: |
1174 | 1198 | return self._sync(self._async_obj.title()) |
1175 | 1199 |
|
1176 | 1200 |
|
| 1201 | +mapping.register(FrameAsync, Frame) |
| 1202 | + |
| 1203 | + |
1177 | 1204 | class Worker(SyncBase): |
1178 | 1205 | def __init__(self, obj: WorkerAsync): |
1179 | 1206 | super().__init__(obj) |
@@ -1226,6 +1253,9 @@ def evaluateHandle( |
1226 | 1253 | ) |
1227 | 1254 |
|
1228 | 1255 |
|
| 1256 | +mapping.register(WorkerAsync, Worker) |
| 1257 | + |
| 1258 | + |
1229 | 1259 | class Selectors(SyncBase): |
1230 | 1260 | def __init__(self, obj: SelectorsAsync): |
1231 | 1261 | super().__init__(obj) |
@@ -1267,6 +1297,9 @@ def register( |
1267 | 1297 | ) |
1268 | 1298 |
|
1269 | 1299 |
|
| 1300 | +mapping.register(SelectorsAsync, Selectors) |
| 1301 | + |
| 1302 | + |
1270 | 1303 | class ConsoleMessage(SyncBase): |
1271 | 1304 | def __init__(self, obj: ConsoleMessageAsync): |
1272 | 1305 | super().__init__(obj) |
@@ -1315,6 +1348,9 @@ def location(self) -> ConsoleMessageLocation: |
1315 | 1348 | return self._async_obj.location |
1316 | 1349 |
|
1317 | 1350 |
|
| 1351 | +mapping.register(ConsoleMessageAsync, ConsoleMessage) |
| 1352 | + |
| 1353 | + |
1318 | 1354 | class Dialog(SyncBase): |
1319 | 1355 | def __init__(self, obj: DialogAsync): |
1320 | 1356 | super().__init__(obj) |
@@ -1361,6 +1397,9 @@ def dismiss(self) -> NoneType: |
1361 | 1397 | return self._sync(self._async_obj.dismiss()) |
1362 | 1398 |
|
1363 | 1399 |
|
| 1400 | +mapping.register(DialogAsync, Dialog) |
| 1401 | + |
| 1402 | + |
1364 | 1403 | class Download(SyncBase): |
1365 | 1404 | def __init__(self, obj: DownloadAsync): |
1366 | 1405 | super().__init__(obj) |
@@ -1410,6 +1449,9 @@ def path(self) -> typing.Union[str, NoneType]: |
1410 | 1449 | return self._sync(self._async_obj.path()) |
1411 | 1450 |
|
1412 | 1451 |
|
| 1452 | +mapping.register(DownloadAsync, Download) |
| 1453 | + |
| 1454 | + |
1413 | 1455 | class BindingCall(SyncBase): |
1414 | 1456 | def __init__(self, obj: BindingCallAsync): |
1415 | 1457 | super().__init__(obj) |
@@ -1445,6 +1487,9 @@ def call(self, func: typing.Callable[[typing.Dict], typing.Any]) -> NoneType: |
1445 | 1487 | return self._sync(self._async_obj.call(func=func)) |
1446 | 1488 |
|
1447 | 1489 |
|
| 1490 | +mapping.register(BindingCallAsync, BindingCall) |
| 1491 | + |
| 1492 | + |
1448 | 1493 | class Page(SyncBase): |
1449 | 1494 | def __init__(self, obj: PageAsync): |
1450 | 1495 | super().__init__(obj) |
@@ -2075,6 +2120,9 @@ def pdf( |
2075 | 2120 | ) |
2076 | 2121 |
|
2077 | 2122 |
|
| 2123 | +mapping.register(PageAsync, Page) |
| 2124 | + |
| 2125 | + |
2078 | 2126 | class BrowserContext(SyncBase): |
2079 | 2127 | def __init__(self, obj: BrowserContextAsync): |
2080 | 2128 | super().__init__(obj) |
@@ -2197,6 +2245,9 @@ def close(self) -> NoneType: |
2197 | 2245 | return self._sync(self._async_obj.close()) |
2198 | 2246 |
|
2199 | 2247 |
|
| 2248 | +mapping.register(BrowserContextAsync, BrowserContext) |
| 2249 | + |
| 2250 | + |
2200 | 2251 | class Browser(SyncBase): |
2201 | 2252 | def __init__(self, obj: BrowserAsync): |
2202 | 2253 | super().__init__(obj) |
@@ -2327,6 +2378,9 @@ def close(self) -> NoneType: |
2327 | 2378 | return self._sync(self._async_obj.close()) |
2328 | 2379 |
|
2329 | 2380 |
|
| 2381 | +mapping.register(BrowserAsync, Browser) |
| 2382 | + |
| 2383 | + |
2330 | 2384 | class BrowserServer(SyncBase): |
2331 | 2385 | def __init__(self, obj: BrowserServerAsync): |
2332 | 2386 | super().__init__(obj) |
@@ -2373,6 +2427,9 @@ def close(self) -> NoneType: |
2373 | 2427 | return self._sync(self._async_obj.close()) |
2374 | 2428 |
|
2375 | 2429 |
|
| 2430 | +mapping.register(BrowserServerAsync, BrowserServer) |
| 2431 | + |
| 2432 | + |
2376 | 2433 | class BrowserType(SyncBase): |
2377 | 2434 | def __init__(self, obj: BrowserTypeAsync): |
2378 | 2435 | super().__init__(obj) |
@@ -2568,6 +2625,9 @@ def connect( |
2568 | 2625 | ) |
2569 | 2626 |
|
2570 | 2627 |
|
| 2628 | +mapping.register(BrowserTypeAsync, BrowserType) |
| 2629 | + |
| 2630 | + |
2571 | 2631 | class Playwright(SyncBase): |
2572 | 2632 | def __init__(self, obj: PlaywrightAsync): |
2573 | 2633 | super().__init__(obj) |
@@ -2618,3 +2678,6 @@ def selectors(self) -> "Selectors": |
2618 | 2678 | @property |
2619 | 2679 | def devices(self) -> typing.Dict: |
2620 | 2680 | return self._async_obj.devices |
| 2681 | + |
| 2682 | + |
| 2683 | +mapping.register(PlaywrightAsync, Playwright) |
0 commit comments