@@ -97,13 +97,13 @@ def _on_binding(self, binding_call: BindingCall) -> None:
9797 return
9898 asyncio .create_task (binding_call .call (func ))
9999
100- def setDefaultNavigationTimeout (self , timeout : float ) -> None :
100+ def set_default_navigation_timeout (self , timeout : float ) -> None :
101101 self ._timeout_settings .set_navigation_timeout (timeout )
102102 self ._channel .send_no_reply (
103103 "setDefaultNavigationTimeoutNoReply" , dict (timeout = timeout )
104104 )
105105
106- def setDefaultTimeout (self , timeout : float ) -> None :
106+ def set_default_timeout (self , timeout : float ) -> None :
107107 self ._timeout_settings .set_timeout (timeout )
108108 self ._channel .send_no_reply ("setDefaultTimeoutNoReply" , dict (timeout = timeout ))
109109
@@ -115,9 +115,9 @@ def pages(self) -> List[Page]:
115115 def browser (self ) -> Optional ["Browser" ]:
116116 return self ._browser
117117
118- async def newPage (self ) -> Page :
118+ async def new_page (self ) -> Page :
119119 if self ._owner_page :
120- raise Error ("Please use browser.newContext ()" )
120+ raise Error ("Please use browser.new_context ()" )
121121 return from_channel (await self ._channel .send ("newPage" ))
122122
123123 async def cookies (self , urls : Union [str , List [str ]] = None ) -> List [Cookie ]:
@@ -127,39 +127,39 @@ async def cookies(self, urls: Union[str, List[str]] = None) -> List[Cookie]:
127127 urls = [urls ]
128128 return await self ._channel .send ("cookies" , dict (urls = urls ))
129129
130- async def addCookies (self , cookies : List [Cookie ]) -> None :
130+ async def add_cookies (self , cookies : List [Cookie ]) -> None :
131131 await self ._channel .send ("addCookies" , dict (cookies = cookies ))
132132
133- async def clearCookies (self ) -> None :
133+ async def clear_cookies (self ) -> None :
134134 await self ._channel .send ("clearCookies" )
135135
136- async def grantPermissions (
136+ async def grant_permissions (
137137 self , permissions : List [str ], origin : str = None
138138 ) -> None :
139139 await self ._channel .send ("grantPermissions" , locals_to_params (locals ()))
140140
141- async def clearPermissions (self ) -> None :
141+ async def clear_permissions (self ) -> None :
142142 await self ._channel .send ("clearPermissions" )
143143
144- async def setGeolocation (
144+ async def set_geolocation (
145145 self , latitude : float , longitude : float , accuracy : Optional [float ]
146146 ) -> None :
147147 await self ._channel .send (
148148 "setGeolocation" , {"geolocation" : locals_to_params (locals ())}
149149 )
150150
151- async def resetGeolocation (self ) -> None :
151+ async def reset_geolocation (self ) -> None :
152152 await self ._channel .send ("setGeolocation" , {})
153153
154- async def setExtraHTTPHeaders (self , headers : Dict [str , str ]) -> None :
154+ async def set_extra_http_headers (self , headers : Dict [str , str ]) -> None :
155155 await self ._channel .send (
156156 "setExtraHTTPHeaders" , dict (headers = serialize_headers (headers ))
157157 )
158158
159- async def setOffline (self , offline : bool ) -> None :
159+ async def set_offline (self , offline : bool ) -> None :
160160 await self ._channel .send ("setOffline" , dict (offline = offline ))
161161
162- async def addInitScript (
162+ async def add_init_script (
163163 self , script : str = None , path : Union [str , Path ] = None
164164 ) -> None :
165165 if path :
@@ -169,7 +169,7 @@ async def addInitScript(
169169 raise Error ("Either path or source parameter must be specified" )
170170 await self ._channel .send ("addInitScript" , dict (source = script ))
171171
172- async def exposeBinding (
172+ async def expose_binding (
173173 self , name : str , callback : Callable , handle : bool = None
174174 ) -> None :
175175 for page in self ._pages :
@@ -184,8 +184,8 @@ async def exposeBinding(
184184 "exposeBinding" , dict (name = name , needsHandle = handle or False )
185185 )
186186
187- async def exposeFunction (self , name : str , callback : Callable ) -> None :
188- await self .exposeBinding (name , lambda source , * args : callback (* args ))
187+ async def expose_function (self , name : str , callback : Callable ) -> None :
188+ await self .expose_binding (name , lambda source , * args : callback (* args ))
189189
190190 async def route (self , url : URLMatch , handler : RouteHandler ) -> None :
191191 self ._routes .append (RouteHandlerEntry (URLMatcher (url ), handler ))
@@ -208,7 +208,7 @@ async def unroute(
208208 "setNetworkInterceptionEnabled" , dict (enabled = False )
209209 )
210210
211- async def waitForEvent (
211+ async def wait_for_event (
212212 self , event : str , predicate : Callable [[Any ], bool ] = None , timeout : float = None
213213 ) -> Any :
214214 if timeout is None :
@@ -245,7 +245,7 @@ async def close(self) -> None:
245245 if not is_safe_close_error (e ):
246246 raise e
247247
248- async def storageState (self , path : Union [str , Path ] = None ) -> StorageState :
248+ async def storage_state (self , path : Union [str , Path ] = None ) -> StorageState :
249249 result = await self ._channel .send_return_as_dict ("storageState" )
250250 if path :
251251 with open (path , "w" ) as f :
@@ -258,11 +258,11 @@ def expect_event(
258258 predicate : Callable [[Any ], bool ] = None ,
259259 timeout : float = None ,
260260 ) -> EventContextManagerImpl :
261- return EventContextManagerImpl (self .waitForEvent (event , predicate , timeout ))
261+ return EventContextManagerImpl (self .wait_for_event (event , predicate , timeout ))
262262
263263 def expect_page (
264264 self ,
265265 predicate : Callable [[Page ], bool ] = None ,
266266 timeout : float = None ,
267267 ) -> EventContextManagerImpl [Page ]:
268- return EventContextManagerImpl (self .waitForEvent ("page" , predicate , timeout ))
268+ return EventContextManagerImpl (self .wait_for_event ("page" , predicate , timeout ))
0 commit comments