@@ -330,17 +330,17 @@ async def _initialize_har_from_options(
330
330
async def new_page (self ) -> Page :
331
331
if self ._owner_page :
332
332
raise Error ("Please use browser.new_context()" )
333
- return from_channel (await self ._channel .send ("newPage" ))
333
+ return from_channel (await self ._channel .send ("newPage" , None ))
334
334
335
335
async def cookies (self , urls : Union [str , Sequence [str ]] = None ) -> List [Cookie ]:
336
336
if urls is None :
337
337
urls = []
338
338
if isinstance (urls , str ):
339
339
urls = [urls ]
340
- return await self ._channel .send ("cookies" , dict (urls = urls ))
340
+ return await self ._channel .send ("cookies" , None , dict (urls = urls ))
341
341
342
342
async def add_cookies (self , cookies : Sequence [SetCookieParam ]) -> None :
343
- await self ._channel .send ("addCookies" , dict (cookies = cookies ))
343
+ await self ._channel .send ("addCookies" , None , dict (cookies = cookies ))
344
344
345
345
async def clear_cookies (
346
346
self ,
@@ -350,6 +350,7 @@ async def clear_cookies(
350
350
) -> None :
351
351
await self ._channel .send (
352
352
"clearCookies" ,
353
+ None ,
353
354
{
354
355
"name" : name if isinstance (name , str ) else None ,
355
356
"nameRegexSource" : name .pattern if isinstance (name , Pattern ) else None ,
@@ -374,21 +375,21 @@ async def clear_cookies(
374
375
async def grant_permissions (
375
376
self , permissions : Sequence [str ], origin : str = None
376
377
) -> None :
377
- await self ._channel .send ("grantPermissions" , locals_to_params (locals ()))
378
+ await self ._channel .send ("grantPermissions" , None , locals_to_params (locals ()))
378
379
379
380
async def clear_permissions (self ) -> None :
380
- await self ._channel .send ("clearPermissions" )
381
+ await self ._channel .send ("clearPermissions" , None )
381
382
382
383
async def set_geolocation (self , geolocation : Geolocation = None ) -> None :
383
- await self ._channel .send ("setGeolocation" , locals_to_params (locals ()))
384
+ await self ._channel .send ("setGeolocation" , None , locals_to_params (locals ()))
384
385
385
386
async def set_extra_http_headers (self , headers : Dict [str , str ]) -> None :
386
387
await self ._channel .send (
387
- "setExtraHTTPHeaders" , dict (headers = serialize_headers (headers ))
388
+ "setExtraHTTPHeaders" , None , dict (headers = serialize_headers (headers ))
388
389
)
389
390
390
391
async def set_offline (self , offline : bool ) -> None :
391
- await self ._channel .send ("setOffline" , dict (offline = offline ))
392
+ await self ._channel .send ("setOffline" , None , dict (offline = offline ))
392
393
393
394
async def add_init_script (
394
395
self , script : str = None , path : Union [str , Path ] = None
@@ -397,7 +398,7 @@ async def add_init_script(
397
398
script = (await async_readfile (path )).decode ()
398
399
if not isinstance (script , str ):
399
400
raise Error ("Either path or script parameter must be specified" )
400
- await self ._channel .send ("addInitScript" , dict (source = script ))
401
+ await self ._channel .send ("addInitScript" , None , dict (source = script ))
401
402
402
403
async def expose_binding (
403
404
self , name : str , callback : Callable , handle : bool = None
@@ -411,7 +412,7 @@ async def expose_binding(
411
412
raise Error (f'Function "{ name } " has been already registered' )
412
413
self ._bindings [name ] = callback
413
414
await self ._channel .send (
414
- "exposeBinding" , dict (name = name , needsHandle = handle or False )
415
+ "exposeBinding" , None , dict (name = name , needsHandle = handle or False )
415
416
)
416
417
417
418
async def expose_function (self , name : str , callback : Callable ) -> None :
@@ -499,7 +500,7 @@ async def _record_into_har(
499
500
}
500
501
if page :
501
502
params ["page" ] = page ._channel
502
- har_id = await self ._channel .send ("harStart" , params )
503
+ har_id = await self ._channel .send ("harStart" , None , params )
503
504
self ._har_recorders [har_id ] = {
504
505
"path" : str (har ),
505
506
"content" : update_content ,
@@ -535,15 +536,15 @@ async def route_from_har(
535
536
async def _update_interception_patterns (self ) -> None :
536
537
patterns = RouteHandler .prepare_interception_patterns (self ._routes )
537
538
await self ._channel .send (
538
- "setNetworkInterceptionPatterns" , {"patterns" : patterns }
539
+ "setNetworkInterceptionPatterns" , None , {"patterns" : patterns }
539
540
)
540
541
541
542
async def _update_web_socket_interception_patterns (self ) -> None :
542
543
patterns = WebSocketRouteHandler .prepare_interception_patterns (
543
544
self ._web_socket_routes
544
545
)
545
546
await self ._channel .send (
546
- "setWebSocketInterceptionPatterns" , {"patterns" : patterns }
547
+ "setWebSocketInterceptionPatterns" , None , {"patterns" : patterns }
547
548
)
548
549
549
550
def expect_event (
@@ -596,7 +597,7 @@ async def _inner_close() -> None:
596
597
har = cast (
597
598
Artifact ,
598
599
from_channel (
599
- await self ._channel .send ("harExport" , {"harId" : har_id })
600
+ await self ._channel .send ("harExport" , None , {"harId" : har_id })
600
601
),
601
602
)
602
603
# Server side will compress artifact if content is attach or if file is .zip.
@@ -615,14 +616,14 @@ async def _inner_close() -> None:
615
616
await har .delete ()
616
617
617
618
await self ._channel ._connection .wrap_api_call (_inner_close , True )
618
- await self ._channel .send ("close" , {"reason" : reason })
619
+ await self ._channel .send ("close" , None , {"reason" : reason })
619
620
await self ._closed_future
620
621
621
622
async def storage_state (
622
623
self , path : Union [str , Path ] = None , indexedDB : bool = None
623
624
) -> StorageState :
624
625
result = await self ._channel .send_return_as_dict (
625
- "storageState" , {"indexedDB" : indexedDB }
626
+ "storageState" , None , {"indexedDB" : indexedDB }
626
627
)
627
628
if path :
628
629
await async_writefile (path , json .dumps (result ))
@@ -749,7 +750,7 @@ async def new_cdp_session(self, page: Union[Page, Frame]) -> CDPSession:
749
750
params ["frame" ] = page ._channel
750
751
else :
751
752
raise Error ("page: expected Page or Frame" )
752
- return from_channel (await self ._channel .send ("newCDPSession" , params ))
753
+ return from_channel (await self ._channel .send ("newCDPSession" , None , params ))
753
754
754
755
@property
755
756
def tracing (self ) -> Tracing :
0 commit comments