@@ -118,27 +118,24 @@ def add_style_tag(url: nil, path: nil, content: nil)
118
118
private
119
119
120
120
def call ( expression :, arguments : [ ] , on : nil , wait : 0 , handle : true , **options )
121
- params = options . dup
122
121
errors = [ NodeNotFoundError , NoExecutionContextError ]
123
122
attempts , sleep = INTERMITTENT_ATTEMPTS , INTERMITTENT_SLEEP
124
123
125
124
Ferrum . with_attempts ( errors : errors , max : attempts , wait : sleep ) do
126
125
if on
127
126
response = @page . command ( "DOM.resolveNode" , nodeId : on . node_id )
128
127
object_id = response . dig ( "object" , "objectId" )
129
- params . merge! ( objectId : object_id )
130
- elsif params [ :executionContextId ] . nil?
131
- params . merge! ( executionContextId : execution_id )
128
+ options . merge! ( objectId : object_id )
132
129
else
133
- # executionContextId is passed, nop
130
+ options . merge! ( executionContextId : execution_id )
134
131
end
135
132
136
- params . merge! ( functionDeclaration : expression ,
137
- arguments : prepare_args ( arguments ) )
133
+ options . merge! ( functionDeclaration : expression ,
134
+ arguments : prepare_args ( arguments ) )
138
135
139
136
response = @page . command ( "Runtime.callFunctionOn" ,
140
137
wait : wait , slowmoable : true ,
141
- **params )
138
+ **options )
142
139
handle_error ( response )
143
140
response = response [ "result" ]
144
141
0 commit comments