← Back to team overview

sikuli-driver team mailing list archive

[Question #257211]: Sikuli magnifying the matched region and uses the middle of that magnified region leading to failure!

 

New question #257211 on Sikuli:
https://answers.launchpad.net/sikuli/+question/257211

I noticed one thing about Sikuli today that I have not noticed before.

On an image match, it:

1. Magnifies the image
2. Uses that magnified image for all further calculations, for example "getTarget()" will return the middle of that magnified region which will hence be offset from the actual center of the hit on screen!

For example, try the script below on this page: http://jsfiddle.net/h9oaqfy2/

As you can see, the Sikuli script will hover over the table cells, then a magnified version of the image will show up and the Sikuli script will return the middle of that magnified region (hit2l)

Hence, all the clicks fall OUTSIDE the intended region as the magnified version of the image gives an incorrect coordinate for the middle instead of what it really is on screen!

Settings.setShowActions(True)
Settings.ActionLogs = True
Settings.InfoLogs = True
Settings.DebugLogs = True

SCR1 = Screen(0)

ratePat = Pattern("1415500666741.png") # This is a capture of the "Rate" picture: http://i.imgur.com/CI4SZMS.png
ratePatSimilarity = 0.84 # 84% similar

try:
    qm1All = SCR1.findAll(ratePat.similar(ratePatSimilarity ))
except FindFailed: # no matches found
    exit(0)
else:
    # sort the icons by their y coordinates and put them into a new variable sorted_icons
    sorted_rateAll = sorted(rateAll, key=lambda m:m.y)
    for hit in sorted_qm1All:
        hit2l = hit.getTarget()
        hitc = SCR1.click(hit2l)
        # Move 26px to right is the text and double Click to highlight the text (then copy paste)
        hit2l_26px_right = hit2l.right(26)
        hitc = SCR1.click(hit2l_26px_right)
        print hit2l
        print hit2l_26px_right
        print hitc
        assert(1 == hitc)

A video grab of the script in action is here: https://vid.me/XR3Q

Is this a bug in Sikuli Script that can be fixed easily?

java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

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