@@ -330,17 +330,17 @@ async def _initialize_har_from_options(
330330 async def new_page (self ) -> Page :
331331 if self ._owner_page :
332332 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 ))
334334
335335 async def cookies (self , urls : Union [str , Sequence [str ]] = None ) -> List [Cookie ]:
336336 if urls is None :
337337 urls = []
338338 if isinstance (urls , str ):
339339 urls = [urls ]
340- return await self ._channel .send ("cookies" , dict (urls = urls ))
340+ return await self ._channel .send ("cookies" , None , dict (urls = urls ))
341341
342342 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 ))
344344
345345 async def clear_cookies (
346346 self ,
@@ -350,6 +350,7 @@ async def clear_cookies(
350350 ) -> None :
351351 await self ._channel .send (
352352 "clearCookies" ,
353+ None ,
353354 {
354355 "name" : name if isinstance (name , str ) else None ,
355356 "nameRegexSource" : name .pattern if isinstance (name , Pattern ) else None ,
@@ -374,21 +375,21 @@ async def clear_cookies(
374375 async def grant_permissions (
375376 self , permissions : Sequence [str ], origin : str = None
376377 ) -> None :
377- await self ._channel .send ("grantPermissions" , locals_to_params (locals ()))
378+ await self ._channel .send ("grantPermissions" , None , locals_to_params (locals ()))
378379
379380 async def clear_permissions (self ) -> None :
380- await self ._channel .send ("clearPermissions" )
381+ await self ._channel .send ("clearPermissions" , None )
381382
382383 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 ()))
384385
385386 async def set_extra_http_headers (self , headers : Dict [str , str ]) -> None :
386387 await self ._channel .send (
387- "setExtraHTTPHeaders" , dict (headers = serialize_headers (headers ))
388+ "setExtraHTTPHeaders" , None , dict (headers = serialize_headers (headers ))
388389 )
389390
390391 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 ))
392393
393394 async def add_init_script (
394395 self , script : str = None , path : Union [str , Path ] = None
@@ -397,7 +398,7 @@ async def add_init_script(
397398 script = (await async_readfile (path )).decode ()
398399 if not isinstance (script , str ):
399400 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 ))
401402
402403 async def expose_binding (
403404 self , name : str , callback : Callable , handle : bool = None
@@ -411,7 +412,7 @@ async def expose_binding(
411412 raise Error (f'Function "{ name } " has been already registered' )
412413 self ._bindings [name ] = callback
413414 await self ._channel .send (
414- "exposeBinding" , dict (name = name , needsHandle = handle or False )
415+ "exposeBinding" , None , dict (name = name , needsHandle = handle or False )
415416 )
416417
417418 async def expose_function (self , name : str , callback : Callable ) -> None :
@@ -499,7 +500,7 @@ async def _record_into_har(
499500 }
500501 if page :
501502 params ["page" ] = page ._channel
502- har_id = await self ._channel .send ("harStart" , params )
503+ har_id = await self ._channel .send ("harStart" , None , params )
503504 self ._har_recorders [har_id ] = {
504505 "path" : str (har ),
505506 "content" : update_content ,
@@ -535,15 +536,15 @@ async def route_from_har(
535536 async def _update_interception_patterns (self ) -> None :
536537 patterns = RouteHandler .prepare_interception_patterns (self ._routes )
537538 await self ._channel .send (
538- "setNetworkInterceptionPatterns" , {"patterns" : patterns }
539+ "setNetworkInterceptionPatterns" , None , {"patterns" : patterns }
539540 )
540541
541542 async def _update_web_socket_interception_patterns (self ) -> None :
542543 patterns = WebSocketRouteHandler .prepare_interception_patterns (
543544 self ._web_socket_routes
544545 )
545546 await self ._channel .send (
546- "setWebSocketInterceptionPatterns" , {"patterns" : patterns }
547+ "setWebSocketInterceptionPatterns" , None , {"patterns" : patterns }
547548 )
548549
549550 def expect_event (
@@ -596,7 +597,7 @@ async def _inner_close() -> None:
596597 har = cast (
597598 Artifact ,
598599 from_channel (
599- await self ._channel .send ("harExport" , {"harId" : har_id })
600+ await self ._channel .send ("harExport" , None , {"harId" : har_id })
600601 ),
601602 )
602603 # Server side will compress artifact if content is attach or if file is .zip.
@@ -615,14 +616,14 @@ async def _inner_close() -> None:
615616 await har .delete ()
616617
617618 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 })
619620 await self ._closed_future
620621
621622 async def storage_state (
622623 self , path : Union [str , Path ] = None , indexedDB : bool = None
623624 ) -> StorageState :
624625 result = await self ._channel .send_return_as_dict (
625- "storageState" , {"indexedDB" : indexedDB }
626+ "storageState" , None , {"indexedDB" : indexedDB }
626627 )
627628 if path :
628629 await async_writefile (path , json .dumps (result ))
@@ -749,7 +750,7 @@ async def new_cdp_session(self, page: Union[Page, Frame]) -> CDPSession:
749750 params ["frame" ] = page ._channel
750751 else :
751752 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 ))
753754
754755 @property
755756 def tracing (self ) -> Tracing :
0 commit comments