37
37
from playwright .element_handle import ElementHandle as ElementHandleImpl
38
38
from playwright .file_chooser import FileChooser as FileChooserImpl
39
39
from playwright .frame import Frame as FrameImpl
40
- from playwright .helper import (
40
+ from playwright .input import Keyboard as KeyboardImpl
41
+ from playwright .input import Mouse as MouseImpl
42
+ from playwright .input import Touchscreen as TouchscreenImpl
43
+ from playwright .js_handle import JSHandle as JSHandleImpl
44
+ from playwright .network import Request as RequestImpl
45
+ from playwright .network import Response as ResponseImpl
46
+ from playwright .network import Route as RouteImpl
47
+ from playwright .network import WebSocket as WebSocketImpl
48
+ from playwright .page import BindingCall as BindingCallImpl
49
+ from playwright .page import Page as PageImpl
50
+ from playwright .page import Worker as WorkerImpl
51
+ from playwright .playwright import Playwright as PlaywrightImpl
52
+ from playwright .selectors import Selectors as SelectorsImpl
53
+ from playwright .types import (
41
54
ConsoleMessageLocation ,
55
+ Cookie ,
42
56
Credentials ,
43
57
DeviceDescriptor ,
44
58
Error ,
54
68
RequestFailure ,
55
69
ResourceTiming ,
56
70
SelectOption ,
57
- SetStorageState ,
58
71
StorageState ,
59
- Viewport ,
60
72
)
61
- from playwright .input import Keyboard as KeyboardImpl
62
- from playwright .input import Mouse as MouseImpl
63
- from playwright .input import Touchscreen as TouchscreenImpl
64
- from playwright .js_handle import JSHandle as JSHandleImpl
65
- from playwright .network import Request as RequestImpl
66
- from playwright .network import Response as ResponseImpl
67
- from playwright .network import Route as RouteImpl
68
- from playwright .network import WebSocket as WebSocketImpl
69
- from playwright .page import BindingCall as BindingCallImpl
70
- from playwright .page import Page as PageImpl
71
- from playwright .page import Worker as WorkerImpl
72
- from playwright .playwright import Playwright as PlaywrightImpl
73
- from playwright .selectors import Selectors as SelectorsImpl
74
73
from playwright .video import Video as VideoImpl
75
74
76
75
NoneType = type (None )
@@ -4548,7 +4547,7 @@ async def setViewportSize(self, width: int, height: int) -> NoneType:
4548
4547
await self ._impl_obj .setViewportSize (width = width , height = height )
4549
4548
)
4550
4549
4551
- def viewportSize (self ) -> typing .Union [Viewport , NoneType ]:
4550
+ def viewportSize (self ) -> typing .Union [IntSize , NoneType ]:
4552
4551
"""Page.viewportSize
4553
4552
4554
4553
Returns
@@ -5920,7 +5919,7 @@ async def newPage(self) -> "Page":
5920
5919
5921
5920
async def cookies (
5922
5921
self , urls : typing .Union [str , typing .List [str ]] = None
5923
- ) -> typing .List [typing . Dict ]:
5922
+ ) -> typing .List [Cookie ]:
5924
5923
"""BrowserContext.cookies
5925
5924
5926
5925
If no URLs are specified, this method returns all cookies. If URLs are specified, only cookies that affect those URLs
@@ -5933,23 +5932,21 @@ async def cookies(
5933
5932
5934
5933
Returns
5935
5934
-------
5936
- List[Dict ]
5935
+ List[{"name": str, "value": str, "url": Optional[str], "domain": Optional[str], "path": Optional[str], "expires": Optional[int], "httpOnly": Optional[bool], "secure": Optional[bool], "sameSite": Optional[Literal['Strict', 'Lax', 'None']]} ]
5937
5936
"""
5938
5937
return mapping .from_maybe_impl (await self ._impl_obj .cookies (urls = urls ))
5939
5938
5940
- async def addCookies (self , cookies : typing .List [typing . Dict ]) -> NoneType :
5939
+ async def addCookies (self , cookies : typing .List [Cookie ]) -> NoneType :
5941
5940
"""BrowserContext.addCookies
5942
5941
5943
5942
Adds cookies into this browser context. All pages within this context will have these cookies installed. Cookies can be
5944
5943
obtained via browserContext.cookies([urls]).
5945
5944
5946
5945
Parameters
5947
5946
----------
5948
- cookies : List[Dict ]
5947
+ cookies : List[{"name": str, "value": str, "url": Optional[str], "domain": Optional[str], "path": Optional[str], "expires": Optional[int], "httpOnly": Optional[bool], "secure": Optional[bool], "sameSite": Optional[Literal['Strict', 'Lax', 'None']]} ]
5949
5948
"""
5950
- return mapping .from_maybe_impl (
5951
- await self ._impl_obj .addCookies (cookies = mapping .to_impl (cookies ))
5952
- )
5949
+ return mapping .from_maybe_impl (await self ._impl_obj .addCookies (cookies = cookies ))
5953
5950
5954
5951
async def clearCookies (self ) -> NoneType :
5955
5952
"""BrowserContext.clearCookies
@@ -6218,7 +6215,7 @@ async def storageState(self) -> StorageState:
6218
6215
6219
6216
Returns
6220
6217
-------
6221
- {"cookies": List[Dict ], "origins": List[Dict]}
6218
+ {"cookies": Optional[ List[{"name": str, "value": str, "url": Optional[str ], "domain": Optional[str], "path": Optional[str], "expires": Optional[int], "httpOnly": Optional[bool], "secure": Optional[bool], "sameSite": Optional[Literal['Strict', 'Lax', 'None']]}]], " origins": Optional[ List[Dict] ]}
6222
6219
"""
6223
6220
return mapping .from_maybe_impl (await self ._impl_obj .storageState ())
6224
6221
@@ -6430,7 +6427,7 @@ async def newContext(
6430
6427
videoSize : IntSize = None ,
6431
6428
recordHar : RecordHarOptions = None ,
6432
6429
recordVideo : RecordVideoOptions = None ,
6433
- storageState : SetStorageState = None ,
6430
+ storageState : StorageState = None ,
6434
6431
) -> "BrowserContext" :
6435
6432
"""Browser.newContext
6436
6433
@@ -6481,7 +6478,7 @@ async def newContext(
6481
6478
Enables HAR recording for all pages into `recordHar.path` file. If not specified, the HAR is not recorded. Make sure to await browserContext.close() for the HAR to be saved.
6482
6479
recordVideo : Optional[{"dir": str, "size": Optional[{"width": int, "height": int}]}]
6483
6480
Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await browserContext.close() for videos to be saved.
6484
- storageState : Optional[{"cookies": Optional[List[Dict ]], "origins": Optional[List[Dict]]}]
6481
+ storageState : Optional[{"cookies": Optional[List[{"name": str, "value": str, "url": Optional[str], "domain": Optional[str], "path": Optional[str], "expires": Optional[int], "httpOnly": Optional[bool], "secure": Optional[bool], "sameSite": Optional[Literal['Strict', 'Lax', 'None']]} ]], "origins": Optional[List[Dict]]}]
6485
6482
Populates context with given storage state. This method can be used to initialize context with logged-in information obtained via browserContext.storageState().
6486
6483
6487
6484
Returns
@@ -6542,7 +6539,7 @@ async def newPage(
6542
6539
videoSize : IntSize = None ,
6543
6540
recordHar : RecordHarOptions = None ,
6544
6541
recordVideo : RecordVideoOptions = None ,
6545
- storageState : SetStorageState = None ,
6542
+ storageState : StorageState = None ,
6546
6543
) -> "Page" :
6547
6544
"""Browser.newPage
6548
6545
@@ -6596,7 +6593,7 @@ async def newPage(
6596
6593
Enables HAR recording for all pages into `recordHar.path` file. If not specified, the HAR is not recorded. Make sure to await browserContext.close() for the HAR to be saved.
6597
6594
recordVideo : Optional[{"dir": str, "size": Optional[{"width": int, "height": int}]}]
6598
6595
Enables video recording for all pages into `recordVideo.dir` directory. If not specified videos are not recorded. Make sure to await browserContext.close() for videos to be saved.
6599
- storageState : Optional[{"cookies": Optional[List[Dict ]], "origins": Optional[List[Dict]]}]
6596
+ storageState : Optional[{"cookies": Optional[List[{"name": str, "value": str, "url": Optional[str], "domain": Optional[str], "path": Optional[str], "expires": Optional[int], "httpOnly": Optional[bool], "secure": Optional[bool], "sameSite": Optional[Literal['Strict', 'Lax', 'None']]} ]], "origins": Optional[List[Dict]]}]
6600
6597
Populates context with given storage state. This method can be used to initialize context with logged-in information obtained via browserContext.storageState().
6601
6598
6602
6599
Returns
0 commit comments