18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Random Failures
Hi,
We have tests which run fine individually most of the time, but occasionally, the script will fail at random points, but generally are related to the first action when a page loads, we have tried putting delays (_waits) in, but this has no effect.
Has anyone any suggestions on why this may be happening and how we can ensure our scripts wont fail?
Thanks,
pb.
We have tests which run fine individually most of the time, but occasionally, the script will fail at random points, but generally are related to the first action when a page loads, we have tried putting delays (_waits) in, but this has no effect.
Has anyone any suggestions on why this may be happening and how we can ensure our scripts wont fail?
Thanks,
pb.
Comments
The first thing you did is good : add some delays, but with "_wait(...); " not with _waits
Then you have to know that after a number of steps, sahi do not manage to keep on working normally ... and can fail at any moment. Then you have generally no log file...
The first is _wait(some_number_of_milliseconds) e.g. _wait(1000);
There is another form that take two parameters: the number of milliseconds to wait or a condition to meet e.g. _wait(1000, _assertNotNull(_link("Next")));
The second version will until the timer elapses or the condition is met, whichever comes first.
My favorite technique is using the second version after clicking a button and I'm not sure how long the process will take to complete, so I set the timer for a long length of time and set an assertion to check for the title of the web page I expect to be loaded:
_wait(120000, _assertTrue(document.title == "Target page to look for");
This helps me get around areas where performance isn't uniform.