@@ -56,9 +56,7 @@ PublicElement.get_attribute = function(public, private, attribute_name)
5656end
5757
5858
59-
60-
61- PublicElement .execute_script = function (public , private , script , ...)
59+ PublicElement .get_requisition_props = function (public , private , script , ...)
6260 if not script or type (script ) ~= " string" then
6361 error (" Script should be a non-empty string" )
6462 end
@@ -68,7 +66,7 @@ PublicElement.execute_script = function(public, private, script, ...)
6866 -- Insert the element reference as the first argument (arguments[0] in JavaScript)
6967 local element_ref = {[" element-6066-11e4-a52e-4f735466cecf" ] = private .element_id }
7068 table.insert (args , 1 , element_ref )
71- local requisition_props = {
69+ return {
7270 method = " POST" ,
7371 http_version = " 1.1" ,
7472 url = private .url .. " /session/" .. private .session_id .. " /execute/sync" ,
@@ -77,6 +75,10 @@ PublicElement.execute_script = function(public, private, script, ...)
7775 args = args
7876 }
7977 }
78+ end
79+
80+ PublicElement .execute_script = function (public , private , script , ...)
81+ local requisition_props = public .get_requisition_props (script , ... )
8082 local response = private .fetch (requisition_props )
8183
8284 if response .status_code == 200 then
0 commit comments