sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #07617
Re: [Question #182237]: Does anybody know faster search method when the target is located below of the page?
Question #182237 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/182237
Status: Open => Answered
RaiMan proposed the following answer:
I think using the wheel function is the fastest and most flexible
feature to use in these cases.
I would suggest the following improvements:
hover("some_image_inside_window.png")
mouseLocation = Env.getMouseLocation()
maxSteps = 1000
steps = 3
while maxSteps > 0:
if reg.exists("ZLQQiu.png", 0):
popup("Congrats!")
break
wheel(mouseLocation,WHEEL_DOWN,steps)
maxSteps -= steps
--- we go to somewhere in the window using hover(), to get a starting point for the scroll operation.
--- we loop until the image is found, but a max number of steps to avoid infinite looping
--- we use exists(image, 0), to save time: only one search try is done. Without the 0 as 2nd parameter, each unsuccessful search would wait 3 seconds.
--- we only search once inside the loop (in your case, each unsuccessful search would have taken 6 seconds). Each step now should take about 0.5 seconds
--- Take Care: depending on the stepping and the speed of scrolling a short wait() might be needed after the wheel():
wheel(mouseLocation,WHEEL_DOWN,steps); wait(0.5)
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.