3737from playwright .element_handle import ElementHandle as ElementHandleImpl
3838from playwright .file_chooser import FileChooser as FileChooserImpl
3939from 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 (
4154 ConsoleMessageLocation ,
55+ Cookie ,
4256 Credentials ,
4357 DeviceDescriptor ,
4458 Error ,
5468 RequestFailure ,
5569 ResourceTiming ,
5670 SelectOption ,
57- SetStorageState ,
5871 StorageState ,
59- Viewport ,
6072)
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
7473from playwright .video import Video as VideoImpl
7574
7675NoneType = type (None )
@@ -4548,7 +4547,7 @@ async def setViewportSize(self, width: int, height: int) -> NoneType:
45484547 await self ._impl_obj .setViewportSize (width = width , height = height )
45494548 )
45504549
4551- def viewportSize (self ) -> typing .Union [Viewport , NoneType ]:
4550+ def viewportSize (self ) -> typing .Union [IntSize , NoneType ]:
45524551 """Page.viewportSize
45534552
45544553 Returns
@@ -5920,7 +5919,7 @@ async def newPage(self) -> "Page":
59205919
59215920 async def cookies (
59225921 self , urls : typing .Union [str , typing .List [str ]] = None
5923- ) -> typing .List [typing . Dict ]:
5922+ ) -> typing .List [Cookie ]:
59245923 """BrowserContext.cookies
59255924
59265925 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(
59335932
59345933 Returns
59355934 -------
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']]} ]
59375936 """
59385937 return mapping .from_maybe_impl (await self ._impl_obj .cookies (urls = urls ))
59395938
5940- async def addCookies (self , cookies : typing .List [typing . Dict ]) -> NoneType :
5939+ async def addCookies (self , cookies : typing .List [Cookie ]) -> NoneType :
59415940 """BrowserContext.addCookies
59425941
59435942 Adds cookies into this browser context. All pages within this context will have these cookies installed. Cookies can be
59445943 obtained via browserContext.cookies([urls]).
59455944
59465945 Parameters
59475946 ----------
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']]} ]
59495948 """
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 ))
59535950
59545951 async def clearCookies (self ) -> NoneType :
59555952 """BrowserContext.clearCookies
@@ -6218,7 +6215,7 @@ async def storageState(self) -> StorageState:
62186215
62196216 Returns
62206217 -------
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] ]}
62226219 """
62236220 return mapping .from_maybe_impl (await self ._impl_obj .storageState ())
62246221
@@ -6430,7 +6427,7 @@ async def newContext(
64306427 videoSize : IntSize = None ,
64316428 recordHar : RecordHarOptions = None ,
64326429 recordVideo : RecordVideoOptions = None ,
6433- storageState : SetStorageState = None ,
6430+ storageState : StorageState = None ,
64346431 ) -> "BrowserContext" :
64356432 """Browser.newContext
64366433
@@ -6481,7 +6478,7 @@ async def newContext(
64816478 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.
64826479 recordVideo : Optional[{"dir": str, "size": Optional[{"width": int, "height": int}]}]
64836480 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]]}]
64856482 Populates context with given storage state. This method can be used to initialize context with logged-in information obtained via browserContext.storageState().
64866483
64876484 Returns
@@ -6542,7 +6539,7 @@ async def newPage(
65426539 videoSize : IntSize = None ,
65436540 recordHar : RecordHarOptions = None ,
65446541 recordVideo : RecordVideoOptions = None ,
6545- storageState : SetStorageState = None ,
6542+ storageState : StorageState = None ,
65466543 ) -> "Page" :
65476544 """Browser.newPage
65486545
@@ -6596,7 +6593,7 @@ async def newPage(
65966593 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.
65976594 recordVideo : Optional[{"dir": str, "size": Optional[{"width": int, "height": int}]}]
65986595 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]]}]
66006597 Populates context with given storage state. This method can be used to initialize context with logged-in information obtained via browserContext.storageState().
66016598
66026599 Returns
0 commit comments