maestro icon indicating copy to clipboard operation
maestro copied to clipboard

setTimeout in runScript

Open dansimau opened this issue 2 years ago • 2 comments
trafficstars

I am using runScript to execute a JS script but, I get the following error:

TypeError: TypeError: setTimeout is not a function, it is object. (scripts/fetch-invitation-url.js#11)}

Inside the script I am trying to sleep before performing a HTTP request (with retries), as I need to wait for an async process on my backend to finish executing.

Is setTimeout supported? Is there another wait for me to pause execution for a period of time?

dansimau avatar Sep 22 '23 14:09 dansimau

+1

NicolaGugole avatar Nov 10 '23 13:11 NicolaGugole

Bump, +1

mikevercoelen avatar Jan 27 '24 08:01 mikevercoelen

What JS engine do you use? GraalJS or Rhino? Please also share your script, your flow, and in general, as much info as you can to make debugging easy for us.

bartekpacia avatar Jul 27 '24 00:07 bartekpacia

I checked it. setTimeout works only with GraalJS.

appId: com.example.example
jsEngine: graaljs
---
- launchApp
- runScript:
    file: script.js
setTimeout(() => {
  console.log("Delayed for 1 second.");
}, 1000);

Solution: please use GraalJS instead of RhinoJS.

bartekpacia avatar Aug 15 '24 21:08 bartekpacia

This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue. Thank you for helping keep us our issue tracker clean!

github-actions[bot] avatar Aug 22 '24 22:08 github-actions[bot]