@@ -255,70 +255,57 @@ export class ElementHandle<T extends Node = Node> extends js.JSHandle<T> {
255
255
if ( ! force )
256
256
await this . _waitForDisplayedAtStablePositionAndEnabled ( deadline ) ;
257
257
258
- let paused = false ;
259
- try {
260
- await this . _page . _delegate . setActivityPaused ( true ) ;
261
- paused = true ;
262
-
263
- this . _page . _log ( inputLog , 'scrolling into view if needed...' ) ;
264
- const scrolled = await this . _scrollRectIntoViewIfNeeded ( position ? { x : position . x , y : position . y , width : 0 , height : 0 } : undefined ) ;
265
- if ( scrolled === 'invisible' ) {
266
- if ( force )
267
- throw new Error ( 'Element is not visible' ) ;
268
- this . _page . _log ( inputLog , '...element is not visible, retrying input action' ) ;
258
+ this . _page . _log ( inputLog , 'scrolling into view if needed...' ) ;
259
+ const scrolled = await this . _scrollRectIntoViewIfNeeded ( position ? { x : position . x , y : position . y , width : 0 , height : 0 } : undefined ) ;
260
+ if ( scrolled === 'invisible' ) {
261
+ if ( force )
262
+ throw new Error ( 'Element is not visible' ) ;
263
+ this . _page . _log ( inputLog , '...element is not visible, retrying input action' ) ;
264
+ return 'retry' ;
265
+ }
266
+ this . _page . _log ( inputLog , '...done scrolling' ) ;
267
+
268
+ const maybePoint = position ? await this . _offsetPoint ( position ) : await this . _clickablePoint ( ) ;
269
+ if ( maybePoint === 'invisible' ) {
270
+ if ( force )
271
+ throw new Error ( 'Element is not visible' ) ;
272
+ this . _page . _log ( inputLog , 'element is not visibile, retrying input action' ) ;
273
+ return 'retry' ;
274
+ }
275
+ if ( maybePoint === 'outsideviewport' ) {
276
+ if ( force )
277
+ throw new Error ( 'Element is outside of the viewport' ) ;
278
+ this . _page . _log ( inputLog , 'element is outside of the viewport, retrying input action' ) ;
279
+ return 'retry' ;
280
+ }
281
+ const point = roundPoint ( maybePoint ) ;
282
+
283
+ if ( ! force ) {
284
+ if ( ( options as any ) . __testHookBeforeHitTarget )
285
+ await ( options as any ) . __testHookBeforeHitTarget ( ) ;
286
+ this . _page . _log ( inputLog , `checking that element receives pointer events at (${ point . x } ,${ point . y } )...` ) ;
287
+ const matchesHitTarget = await this . _checkHitTargetAt ( point ) ;
288
+ if ( ! matchesHitTarget ) {
289
+ this . _page . _log ( inputLog , '...element does not receive pointer events, retrying input action' ) ;
269
290
return 'retry' ;
270
291
}
271
- this . _page . _log ( inputLog , '...done scrolling' ) ;
292
+ this . _page . _log ( inputLog , `...element does receive pointer events, continuing input action` ) ;
293
+ }
272
294
273
- const maybePoint = position ? await this . _offsetPoint ( position ) : await this . _clickablePoint ( ) ;
274
- if ( maybePoint === 'invisible' ) {
275
- if ( force )
276
- throw new Error ( 'Element is not visible' ) ;
277
- this . _page . _log ( inputLog , 'element is not visibile, retrying input action' ) ;
278
- return 'retry' ;
279
- }
280
- if ( maybePoint === 'outsideviewport' ) {
281
- if ( force )
282
- throw new Error ( 'Element is outside of the viewport' ) ;
283
- this . _page . _log ( inputLog , 'element is outside of the viewport, retrying input action' ) ;
284
- return 'retry' ;
285
- }
286
- const point = roundPoint ( maybePoint ) ;
287
-
288
- if ( ! force ) {
289
- if ( ( options as any ) . __testHookBeforeHitTarget )
290
- await ( options as any ) . __testHookBeforeHitTarget ( ) ;
291
- this . _page . _log ( inputLog , `checking that element receives pointer events at (${ point . x } ,${ point . y } )...` ) ;
292
- const matchesHitTarget = await this . _checkHitTargetAt ( point ) ;
293
- if ( ! matchesHitTarget ) {
294
- this . _page . _log ( inputLog , '...element does not receive pointer events, retrying input action' ) ;
295
- await this . _page . _delegate . setActivityPaused ( false ) ;
296
- paused = false ;
297
- return 'retry' ;
298
- }
299
- this . _page . _log ( inputLog , `...element does receive pointer events, continuing input action` ) ;
300
- }
295
+ await this . _page . _frameManager . waitForSignalsCreatedBy ( async ( ) => {
296
+ let restoreModifiers : input . Modifier [ ] | undefined ;
297
+ if ( options && options . modifiers )
298
+ restoreModifiers = await this . _page . keyboard . _ensureModifiers ( options . modifiers ) ;
299
+ this . _page . _log ( inputLog , `performing "${ actionName } " action...` ) ;
300
+ await action ( point ) ;
301
+ this . _page . _log ( inputLog , `... "${ actionName } " action done` ) ;
302
+ this . _page . _log ( inputLog , 'waiting for scheduled navigations to finish...' ) ;
303
+ if ( restoreModifiers )
304
+ await this . _page . keyboard . _ensureModifiers ( restoreModifiers ) ;
305
+ } , deadline , options , true ) ;
306
+ this . _page . _log ( inputLog , '...navigations have finished' ) ;
301
307
302
- await this . _page . _frameManager . waitForSignalsCreatedBy ( async ( ) => {
303
- let restoreModifiers : input . Modifier [ ] | undefined ;
304
- if ( options && options . modifiers )
305
- restoreModifiers = await this . _page . keyboard . _ensureModifiers ( options . modifiers ) ;
306
- this . _page . _log ( inputLog , `performing "${ actionName } " action...` ) ;
307
- await action ( point ) ;
308
- this . _page . _log ( inputLog , `... "${ actionName } " action done` ) ;
309
- this . _page . _log ( inputLog , 'waiting for scheduled navigations to finish...' ) ;
310
- await this . _page . _delegate . setActivityPaused ( false ) ;
311
- paused = false ;
312
- if ( restoreModifiers )
313
- await this . _page . keyboard . _ensureModifiers ( restoreModifiers ) ;
314
- } , deadline , options , true ) ;
315
- this . _page . _log ( inputLog , '...navigations have finished' ) ;
316
-
317
- return 'done' ;
318
- } finally {
319
- if ( paused )
320
- await this . _page . _delegate . setActivityPaused ( false ) ;
321
- }
308
+ return 'done' ;
322
309
}
323
310
324
311
hover ( options ?: PointerActionOptions & types . PointerActionWaitOptions ) : Promise < void > {
0 commit comments