← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #162070]: scroll using java

 

Question #162070 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/162070

RaiMan posted a new comment:
Sorry, to be late ;-)

using "not exists()" is a bit tricky:

since the "normal situation" is the "not found", every exists() takes 3
seconds ;-) the default waiting time!

In these situations, use exists(img, 0) which immediately returns after
the first search trial.

So in your example with the dropdown list, you might restrict the search
to the fixed region, where the entries traverse, when scrolling down or
up (I recommend to use Sikuli's wheel()
(http://sikuli.org/docx/region.html#Region.wheel))

so with something like this:

reg = Region( ... ) # the "looking glass"
steps = some-value # approriate value for stepped scrolldown
wheelPoint = reg.below(10).getCenter() # appropriate location to scroll
while not reg.exists("image-of-searched-item.png", 0):
     wheel(wheelPoint, WHEEL_DOWN, steps)

the thing should be speedy enough (a step should be about 0.2 seconds)

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.