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.
wait until ajax response
I have looked at the conditional wait but it seems a bit hard to know exactly what the ajax update will do to dom. Is their on way of saying "wait utill the next ajax response"?
Comments
Guessing a large enough wait makes the script very slow so I am going to put in conditional waits. That effectively means that I have to extensively manually edit the script to work out the conditions for each wait. This is why I would like Sahi it to "wait until after the next ajax response processing has finished".
Don't add conditional waits yet. Instead, open sahi.properties and tweak these values:
#Number of retries once an error occurs
script.max_reattempts_on_error=10
#Number of cycles Sahi will wait for the page to load before it proceeds with execution
#Time spent is (script.max_cycles_for_page_load x script.time_between_steps) milliseconds
script.max_cycles_for_page_load=1500
Let us know if this helps.
Regards,
Narayan
If there was a way of saying 'wait until any ajax response comes back' then the script would wait until the server had acknowledged the last action.
Sahi also waits for AJAX requests automatically, but it has a timeout. Let me check and let you know if that can be modified.
Meanwhile, there is a new version of Sahi, released today, which helps load ZK pages much faster because it uses gzip compression while fetching pages. Please check if it helps you resolve this issue.
Regards,
Narayan
Is the expected behaviour the ajax timeout that you mention that the script moves onto the next step which is what I am seeing?
If you private message me your email address I can send you some ZK code with a Thread.sleep(BIG_TIME) on the server that demonstrate the problem.
Does Sahi fail for every AJAX request for you? Is there a place which is extraordinarily slow which is failing? We have tested on the ZK demo pages and things work without any waits. Have you tried with any other site and faced similar results?
Can you email your script and your sample code? My email is narayan@sahi.co.in (It is part of my signature). I suspect it is something specific to your script. Please also attach the information on the Info tab of the Controller.
Regards,
Narayan
I am able to reproduce your problem. Sahi does go ahead as if it has clicked something, even though ZK has not reacted by then.
The fix will be available in the next build. I am emailing you a link to a temporary build till then.
Regards,
Narayan
I did not get an email with the temporary build so I just built sahi from head. Sahi does appear to pause now for the ajax responses. However it now only really works well with ZK5 (which has only been released 1 month) and it now no longer works so well with ZK3.6 as it does not recognise buttons on ZK3.6 as well as it recognises them on ZK5.
I have written more about this on the comments at the bottom of the ZK+Sahi page:
http://docs.zkoss.org/wiki/Making_ZK_Functional_Tests_With_Sahi
thx
Simon
The identification by id should not be a big problem to solve. Sahi basically ignores ids matching some regular expressions. My guess is that the id patterns are different for 3.6 and 5.6. If you can give me a sample of a few ids, (so that I can figure out their pattern) I should be able to guide you to get Sahi working for you.
Btw, did you mean that the public release of Sahi was identifying elements well on 3.6, but the latest version of Sahi you built from source has broken this?
Is there a sample page I can test this out on?
Regards,
Narayan