@@ -55,6 +55,7 @@ def __init__(
5555 self , parent : ChannelOwner , type : str , guid : str , initializer : Dict
5656 ) -> None :
5757 super ().__init__ (parent , type , guid , initializer )
58+ self ._frame = cast ("Frame" , parent )
5859
5960 async def _createSelectorForTest (self , name : str ) -> Optional [str ]:
6061 return await self ._channel .send ("createSelectorForTest" , dict (name = name ))
@@ -104,7 +105,9 @@ async def dispatch_event(self, type: str, eventInit: Dict = None) -> None:
104105 )
105106
106107 async def scroll_into_view_if_needed (self , timeout : float = None ) -> None :
107- await self ._channel .send ("scrollIntoViewIfNeeded" , locals_to_params (locals ()))
108+ await self ._channel .send (
109+ "scrollIntoViewIfNeeded" , self ._locals_to_params_with_timeout (locals ())
110+ )
108111
109112 async def hover (
110113 self ,
@@ -115,7 +118,7 @@ async def hover(
115118 force : bool = None ,
116119 trial : bool = None ,
117120 ) -> None :
118- await self ._channel .send ("hover" , locals_to_params (locals ()))
121+ await self ._channel .send ("hover" , self . _locals_to_params_with_timeout (locals ()))
119122
120123 async def click (
121124 self ,
@@ -129,7 +132,7 @@ async def click(
129132 noWaitAfter : bool = None ,
130133 trial : bool = None ,
131134 ) -> None :
132- await self ._channel .send ("click" , locals_to_params (locals ()))
135+ await self ._channel .send ("click" , self . _locals_to_params_with_timeout (locals ()))
133136
134137 async def dblclick (
135138 self ,
@@ -142,7 +145,9 @@ async def dblclick(
142145 noWaitAfter : bool = None ,
143146 trial : bool = None ,
144147 ) -> None :
145- await self ._channel .send ("dblclick" , locals_to_params (locals ()))
148+ await self ._channel .send (
149+ "dblclick" , self ._locals_to_params_with_timeout (locals ())
150+ )
146151
147152 async def select_option (
148153 self ,
@@ -154,7 +159,7 @@ async def select_option(
154159 force : bool = None ,
155160 noWaitAfter : bool = None ,
156161 ) -> List [str ]:
157- params = locals_to_params (
162+ params = self . _locals_to_params_with_timeout (
158163 dict (
159164 timeout = timeout ,
160165 force = force ,
@@ -172,7 +177,7 @@ async def tap(
172177 noWaitAfter : bool = None ,
173178 trial : bool = None ,
174179 ) -> None :
175- await self ._channel .send ("tap" , locals_to_params (locals ()))
180+ await self ._channel .send ("tap" , self . _locals_to_params_with_timeout (locals ()))
176181
177182 async def fill (
178183 self ,
@@ -181,13 +186,17 @@ async def fill(
181186 noWaitAfter : bool = None ,
182187 force : bool = None ,
183188 ) -> None :
184- await self ._channel .send ("fill" , locals_to_params (locals ()))
189+ await self ._channel .send ("fill" , self . _locals_to_params_with_timeout (locals ()))
185190
186191 async def select_text (self , force : bool = None , timeout : float = None ) -> None :
187- await self ._channel .send ("selectText" , locals_to_params (locals ()))
192+ await self ._channel .send (
193+ "selectText" , self ._locals_to_params_with_timeout (locals ())
194+ )
188195
189196 async def input_value (self , timeout : float = None ) -> str :
190- return await self ._channel .send ("inputValue" , locals_to_params (locals ()))
197+ return await self ._channel .send (
198+ "inputValue" , self ._locals_to_params_with_timeout (locals ())
199+ )
191200
192201 async def set_input_files (
193202 self ,
@@ -219,7 +228,7 @@ async def type(
219228 timeout : float = None ,
220229 noWaitAfter : bool = None ,
221230 ) -> None :
222- await self ._channel .send ("type" , locals_to_params (locals ()))
231+ await self ._channel .send ("type" , self . _locals_to_params_with_timeout (locals ()))
223232
224233 async def press (
225234 self ,
@@ -228,7 +237,7 @@ async def press(
228237 timeout : float = None ,
229238 noWaitAfter : bool = None ,
230239 ) -> None :
231- await self ._channel .send ("press" , locals_to_params (locals ()))
240+ await self ._channel .send ("press" , self . _locals_to_params_with_timeout (locals ()))
232241
233242 async def set_checked (
234243 self ,
@@ -262,7 +271,7 @@ async def check(
262271 noWaitAfter : bool = None ,
263272 trial : bool = None ,
264273 ) -> None :
265- await self ._channel .send ("check" , locals_to_params (locals ()))
274+ await self ._channel .send ("check" , self . _locals_to_params_with_timeout (locals ()))
266275
267276 async def uncheck (
268277 self ,
@@ -272,7 +281,9 @@ async def uncheck(
272281 noWaitAfter : bool = None ,
273282 trial : bool = None ,
274283 ) -> None :
275- await self ._channel .send ("uncheck" , locals_to_params (locals ()))
284+ await self ._channel .send (
285+ "uncheck" , self ._locals_to_params_with_timeout (locals ())
286+ )
276287
277288 async def bounding_box (self ) -> Optional [FloatRect ]:
278289 return await self ._channel .send ("boundingBox" )
@@ -291,7 +302,7 @@ async def screenshot(
291302 maskColor : str = None ,
292303 style : str = None ,
293304 ) -> bytes :
294- params = locals_to_params (locals ())
305+ params = self . _locals_to_params_with_timeout (locals ())
295306 if "path" in params :
296307 del params ["path" ]
297308 if "mask" in params :
@@ -367,7 +378,9 @@ async def wait_for_element_state(
367378 ],
368379 timeout : float = None ,
369380 ) -> None :
370- await self ._channel .send ("waitForElementState" , locals_to_params (locals ()))
381+ await self ._channel .send (
382+ "waitForElementState" , self ._locals_to_params_with_timeout (locals ())
383+ )
371384
372385 async def wait_for_selector (
373386 self ,
@@ -377,9 +390,16 @@ async def wait_for_selector(
377390 strict : bool = None ,
378391 ) -> Optional ["ElementHandle" ]:
379392 return from_nullable_channel (
380- await self ._channel .send ("waitForSelector" , locals_to_params (locals ()))
393+ await self ._channel .send (
394+ "waitForSelector" , self ._locals_to_params_with_timeout (locals ())
395+ )
381396 )
382397
398+ def _locals_to_params_with_timeout (self , args : Dict ) -> Dict :
399+ params = locals_to_params (args )
400+ params ["timeout" ] = self ._frame ._timeout (params .get ("timeout" ))
401+ return params
402+
383403
384404def convert_select_option_values (
385405 value : Union [str , Sequence [str ]] = None ,
0 commit comments