1 changed files with 41 additions and 0 deletions
@ -0,0 +1,41 @@ |
|||||
|
log("Inicio confirmation from LUA!!") |
||||
|
local err |
||||
|
print("BEFORE JSON LOADING payload: " .. json_payload) |
||||
|
local json = require("json") |
||||
|
print("AFTER JSON LOADING") |
||||
|
-- Parse the JSON string |
||||
|
local obj, err = json.decode(json_payload) |
||||
|
|
||||
|
local error_on_page |
||||
|
|
||||
|
-- We need to click on btngenerar first and then we'll see the confirmar button |
||||
|
|
||||
|
err = waitVisibleByQuerySelector("#btngenerar") |
||||
|
if err then |
||||
|
print("Error waiting for btngenerar: " .. err) |
||||
|
return |
||||
|
end |
||||
|
|
||||
|
err = clickElementByQuerySelector("#btngenerar") |
||||
|
if err then |
||||
|
print("Error clicking on btngenerar: " .. err) |
||||
|
return |
||||
|
end |
||||
|
|
||||
|
waitSecs(3) |
||||
|
js_script = [[ |
||||
|
$x("//button[@type='button' and .//span[normalize-space()='Confirmar'] ]")[0].click(); |
||||
|
]] |
||||
|
|
||||
|
print("About to click on Confirmar using this JS: " .. js_script) |
||||
|
|
||||
|
error_on_page, err = evaluateJsWithStringOutput(js_script) |
||||
|
if err then |
||||
|
error("Clicking on Confirmar error: " .. err) |
||||
|
else |
||||
|
print("Clicking on Confirmar success") |
||||
|
end |
||||
|
|
||||
|
waitSecs(2) |
||||
|
|
||||
|
log("Finishing confirmation from LUA!!") |
||||
Loading…
Reference in new issue