import { waitUntil , report } from '../../../utils' ; import { SelectorFluent } from '../../../selector-api' ; import { invokeMethodOnHandle , MethodName } from '../../handle-actions' ; import { InvokeOptions } from '../../page-actions' ; export async function invokeMethodOnSelectorObject ( methodName , selector , options ) { report ( 'waiting for the selector to appear in DOM ...' , options . verbose ) ; await waitUntil ( ( ) => selector . exists ( ) , `Cannot invoke method '${ methodName }' on '${ selector . toString ( ) }' because this selector was not found in DOM` , { ... options , throwOnTimeout : true , wrapPredicateExecutionInsideTryCatch : true , } ) ; const handle = await selector . getHandle ( ) ; await invokeMethodOnHandle ( methodName , handle , selector . toString ( ) ) ; }