The best place to *find* answers to programming/development questions, imo, however it's the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but again, a great reference for *finding* answers.

My Music (Nickleus)

20140331

sahi, suggestion: "_wait(maxTime, condition)" with "AND" functionality, not just "OR" -- stop execution if "condition" returns false

i wish there was an additional "_wait(maxTime, condition)" function that would stop execution if condition returns false.

as of now, it seems as if "wait + condition" continues execution no matter the outcome of "condition", which makes it an "OR" test, but my suggestion would be for an "AND" test, i.e.:
wait, up until maxTime is reached, and if condition is still false, then stop execution.

i want this because of network/server response timing issues, specifically related to ajax operations.

UPDATE
i just posted this as a discussion in the sahi forums:
suggestion for _wait: stop execution if condition returns false

UPDATE, WORKAROUND
to achieve the same thing today, it looks like you'd have to code it like this:
_wait(10000, _assertTrue(_isVisible(_link("detailsForm:saveAgreementBtn"))));
_assertTrue(_isVisible(_link("detailsForm:saveAgreementBtn")));

and this gives the same functionality, but with less code, but also may look potentially confusing:
_wait(10000, _isVisible(_link("detailsForm:saveAgreementBtn")));
_assertTrue(_isVisible(_link("detailsForm:saveAgreementBtn")));

No comments:

Post a Comment