Hello,
I have a HTTP monitor use case where I would like to wait/sleep a few seconds between step 1 and 2
Is it possible to add in pre/post execution scripts kind of sleep(### seconds) or something equivalent ?
Thanks.
Solved! Go to Solution.
You can use JS I think:
you can execute post execution script for the first step which for example will do:
setTimeout(function () {
//you can paste some code here if you need
}, 5000);
I've never tested it, but should be fine 🙂
Sebastian
Thanks @Sebastian K., unfortunately it does not work. I tried something equivalent already (assuming we might be able to execute generic JS script) but it failed.
When I paste your content in a post-execution script, I get the following in log:
Post script execution failed due to: ReferenceError: "setTimeout" is not defined. (script#1)
Ok you're right. Here are possibilities you have:
I don't see anything that can be handy here.
As a really dirt workaround may be creating some page with setTimeout set that you may use as request in the middle which will takes amount of time defined in query parameter.
Sebastian
yes, me too. I reviewed this documentation already. That is why I posted on this forum. I was hoping for some hidden trick.
thanks anyway for your help.
Hi guys
Long shot but you should give it a try and use browser test where you can add wait after step and run JavaScripts.
HTH
Yos
unfortunately not for this specific use case as I am testing an API
Would a dummy API call to sleep for a given time solve your problem? For example, the postman echo service has such endpoint if you don't want to create your own.
This URL will, for example, wait 2 seconds between ending with a response:
https://postman-echo.com/delay/2
This is an interesting approach. Although I would prefer to avoid being dependent on a 3rd party API, I will definitely consider your idea.
Thanks a lot.
Agreed, but this is just an example. Sure you can deploy such API endpoint in your environment and it will be definitely the most simple one service you will have :-).