@@ -56,6 +56,7 @@ def __init__(
56
56
) -> None :
57
57
super ().__init__ (parent , type , guid , initializer )
58
58
self ._frame = cast ("Frame" , parent )
59
+ self ._channel ._set_timeout_calculator (self ._frame ._timeout )
59
60
60
61
async def _createSelectorForTest (self , name : str ) -> Optional [str ]:
61
62
return await self ._channel .send ("createSelectorForTest" , dict (name = name ))
@@ -105,9 +106,7 @@ async def dispatch_event(self, type: str, eventInit: Dict = None) -> None:
105
106
)
106
107
107
108
async def scroll_into_view_if_needed (self , timeout : float = None ) -> None :
108
- await self ._channel .send (
109
- "scrollIntoViewIfNeeded" , self ._locals_to_params_with_timeout (locals ())
110
- )
109
+ await self ._channel .send ("scrollIntoViewIfNeeded" , locals_to_params (locals ()))
111
110
112
111
async def hover (
113
112
self ,
@@ -118,7 +117,7 @@ async def hover(
118
117
force : bool = None ,
119
118
trial : bool = None ,
120
119
) -> None :
121
- await self ._channel .send ("hover" , self . _locals_to_params_with_timeout (locals ()))
120
+ await self ._channel .send ("hover" , locals_to_params (locals ()))
122
121
123
122
async def click (
124
123
self ,
@@ -132,7 +131,7 @@ async def click(
132
131
noWaitAfter : bool = None ,
133
132
trial : bool = None ,
134
133
) -> None :
135
- await self ._channel .send ("click" , self . _locals_to_params_with_timeout (locals ()))
134
+ await self ._channel .send ("click" , locals_to_params (locals ()))
136
135
137
136
async def dblclick (
138
137
self ,
@@ -145,9 +144,7 @@ async def dblclick(
145
144
noWaitAfter : bool = None ,
146
145
trial : bool = None ,
147
146
) -> None :
148
- await self ._channel .send (
149
- "dblclick" , self ._locals_to_params_with_timeout (locals ())
150
- )
147
+ await self ._channel .send ("dblclick" , locals_to_params (locals ()))
151
148
152
149
async def select_option (
153
150
self ,
@@ -159,7 +156,7 @@ async def select_option(
159
156
force : bool = None ,
160
157
noWaitAfter : bool = None ,
161
158
) -> List [str ]:
162
- params = self . _locals_to_params_with_timeout (
159
+ params = locals_to_params (
163
160
dict (
164
161
timeout = timeout ,
165
162
force = force ,
@@ -177,7 +174,7 @@ async def tap(
177
174
noWaitAfter : bool = None ,
178
175
trial : bool = None ,
179
176
) -> None :
180
- await self ._channel .send ("tap" , self . _locals_to_params_with_timeout (locals ()))
177
+ await self ._channel .send ("tap" , locals_to_params (locals ()))
181
178
182
179
async def fill (
183
180
self ,
@@ -186,17 +183,13 @@ async def fill(
186
183
noWaitAfter : bool = None ,
187
184
force : bool = None ,
188
185
) -> None :
189
- await self ._channel .send ("fill" , self . _locals_to_params_with_timeout (locals ()))
186
+ await self ._channel .send ("fill" , locals_to_params (locals ()))
190
187
191
188
async def select_text (self , force : bool = None , timeout : float = None ) -> None :
192
- await self ._channel .send (
193
- "selectText" , self ._locals_to_params_with_timeout (locals ())
194
- )
189
+ await self ._channel .send ("selectText" , locals_to_params (locals ()))
195
190
196
191
async def input_value (self , timeout : float = None ) -> str :
197
- return await self ._channel .send (
198
- "inputValue" , self ._locals_to_params_with_timeout (locals ())
199
- )
192
+ return await self ._channel .send ("inputValue" , locals_to_params (locals ()))
200
193
201
194
async def set_input_files (
202
195
self ,
@@ -228,7 +221,7 @@ async def type(
228
221
timeout : float = None ,
229
222
noWaitAfter : bool = None ,
230
223
) -> None :
231
- await self ._channel .send ("type" , self . _locals_to_params_with_timeout (locals ()))
224
+ await self ._channel .send ("type" , locals_to_params (locals ()))
232
225
233
226
async def press (
234
227
self ,
@@ -237,7 +230,7 @@ async def press(
237
230
timeout : float = None ,
238
231
noWaitAfter : bool = None ,
239
232
) -> None :
240
- await self ._channel .send ("press" , self . _locals_to_params_with_timeout (locals ()))
233
+ await self ._channel .send ("press" , locals_to_params (locals ()))
241
234
242
235
async def set_checked (
243
236
self ,
@@ -271,7 +264,7 @@ async def check(
271
264
noWaitAfter : bool = None ,
272
265
trial : bool = None ,
273
266
) -> None :
274
- await self ._channel .send ("check" , self . _locals_to_params_with_timeout (locals ()))
267
+ await self ._channel .send ("check" , locals_to_params (locals ()))
275
268
276
269
async def uncheck (
277
270
self ,
@@ -281,9 +274,7 @@ async def uncheck(
281
274
noWaitAfter : bool = None ,
282
275
trial : bool = None ,
283
276
) -> None :
284
- await self ._channel .send (
285
- "uncheck" , self ._locals_to_params_with_timeout (locals ())
286
- )
277
+ await self ._channel .send ("uncheck" , locals_to_params (locals ()))
287
278
288
279
async def bounding_box (self ) -> Optional [FloatRect ]:
289
280
return await self ._channel .send ("boundingBox" )
@@ -302,7 +293,7 @@ async def screenshot(
302
293
maskColor : str = None ,
303
294
style : str = None ,
304
295
) -> bytes :
305
- params = self . _locals_to_params_with_timeout (locals ())
296
+ params = locals_to_params (locals ())
306
297
if "path" in params :
307
298
del params ["path" ]
308
299
if "mask" in params :
@@ -378,9 +369,7 @@ async def wait_for_element_state(
378
369
],
379
370
timeout : float = None ,
380
371
) -> None :
381
- await self ._channel .send (
382
- "waitForElementState" , self ._locals_to_params_with_timeout (locals ())
383
- )
372
+ await self ._channel .send ("waitForElementState" , locals_to_params (locals ()))
384
373
385
374
async def wait_for_selector (
386
375
self ,
@@ -390,16 +379,9 @@ async def wait_for_selector(
390
379
strict : bool = None ,
391
380
) -> Optional ["ElementHandle" ]:
392
381
return from_nullable_channel (
393
- await self ._channel .send (
394
- "waitForSelector" , self ._locals_to_params_with_timeout (locals ())
395
- )
382
+ await self ._channel .send ("waitForSelector" , locals_to_params (locals ()))
396
383
)
397
384
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
-
403
385
404
386
def convert_select_option_values (
405
387
value : Union [str , Sequence [str ]] = None ,
0 commit comments