← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #182237]: How to search when the target is located below of the page (scrolling needed)?

 

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

    Status: Answered => Solved

obaskirt confirmed that the question is solved:
Well done Raiman.

I did a benchmark with respect to two methods.  I shared two code
snippets. The benchmark shows that you are right! Whell method is faster
and reliable.

Benchmark Results:
Method-1: Whell Method finds in                  : 11.3 seconds
Method-2: Drag and Drop Method finds in : 19.3 seconds

###Method-1: Whell Method###
reg = Region(Region(x,y,w,z))

hover("1324231594260.png")
mouseLocation = Env.getMouseLocation()
maxSteps = 1000
steps = 3
while maxSteps > 0:
    if reg.exists("ZLQQiu.png", 0):
         popup("Congrats!")
         exit()
    print "maxSteps: ", maxSteps
    wheel(Location(mouseLocation),WHEEL_DOWN,3)
    wait(0.5)
    maxSteps -= steps


###Method-2: Drag and Drop Method###
reg = Region(Region(x,y,w,z))

hover("1323985068132-1.png")
mouseDown((Button.LEFT))
mouseLocation=Env.getMouseLocation()
maxSteps=10000
steps=90

while maxSteps > 0:
    if exists("ZLQQiu.png"):
        popup("Congrats!")
        exit()
    mouseMove(Location(mouseLocation.x,(mouseLocation.y+steps)))  
    steps+=90
    maxSteps-=steps

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