sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #25118
Re: [Question #246387]: Code for reviewing loading bar through out the script
Question #246387 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/246387
Status: Open => Answered
RaiMan proposed the following answer:
if I understand right, then you have some dialog window, that is
presented by some Oracle based app with some fields and buttons.
Your script seems to visit some of these fields one after the other and
while going to the next field, you have inconsistent waiting times due
to internal processing, which in turn is shown by some visual (loading
bar).
So you have known fixed places in your workflow, where you need to check
the loading bar and might need to wait for Oracle to be ready again.
I think, your observe solution is overkill for that (though I admit it
is "attractive" and well done for someone with almost zero knowledge ;-)
I would do it this way - easy and robust:
def myWait(waitTime = 1):
wait(waitTime) # fixed time to wait before checking loading bar (give good old Oracle some time to wake up ;-)
Region(1095,959,179,16).exists(Pattern("1396280999791.png").exact(), 60) # 60 stands for max time in secs to wait, adjust it to your needs
usage:
# some code working with a field
# ready to go to next field
myWait() # waits 1 sec and then checks the loading bar, waits until ready
# go to next field and handle it
# ready to go to next field
myWait(2) # waits 2 secs and then checks the loading bar, waits until ready
This works as long, as Oracle comes back within the given max time (here 60 seconds).
If you replace exists with wait, then you will get a FindFailed crash, if there is a case, that exceeds the max time.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.