click() fails if the underlying image changes even if I passed it a location to click at?

Asked by Tak Eda

I have a webpage with a button that darkens in color when I hover over it (in order to click it)

My sikuli script is able to locate the button fine and highlight even highlights the correct button, however click fails

Thinking that click was failing due to color change, I explicitly grabbed the location (coordinates) from the match and passed it to click but click still fails

I have tried to put in wait(), set ClickDelay, used hover before clicking: nothing works.

Does click() fail if the underlying image changes on hover even if I passed it a location to click at?

Here is what my code looks like:

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

SCR1 = Screen(1)
p1 = Pattern("1402973791825.png")
p2 = Pattern("1402972955014.png")

goOn = True

while goOn:
    try:
        x1 = SCR1.find(p1.exact())
        print x1
        #hover(x1)
        goOn = False
    except FindFailed:
        x2 = SCR1.find(p2.exact())
        x2l = x2.getTarget()
        print x2l
        x2h = x2.hover()
        print x2h
        x2h = x2.hover()
        print x2h

        x2.highlight(5)
        # icon on hover becomes darker

        #sleep(100)
        x2c = x2.doubleClick()
        print x2c
        x2.highlight(5)
        x2.hover(p2)
        wait(0.5)
        Settings.ClickDelay = 0.3
        x2c = x2.click(p2)
        print x2c
        goOn = False
        x2c = x2.mouseDown(Button.LEFT)
        print x2c
        x2c = x2.mouseUp(Button.LEFT)
        print x2c

Question information

Language:
English Edit question
Status:
Open
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Tak Eda (takeda) said :
#1

Here's my java version:

java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b14)
Java HotSpot(TM) Client VM (build 24.55-b03, mixed mode, sharing)

I know the tutorial says to use Java 6 but if that's the sole reason, it would be great if you can tell my why click() will work in 6 but is failing in Java 7 (I have tools on my system that require Java 7 and having Java 6 and 7 installed side by side creates a lot of issues)

Revision history for this message
Tak Eda (takeda) said :
#2

I tested it against a link that does not change in color and the same thing happened, so it's not an issue of the underlying image changing

Revision history for this message
Tak Eda (takeda) said :
#3

I have more information: my script fails if it runs on anything but Screen(0)

If I keep the screen I'm trying to slick on on my primary display, the script executes just fine!

The issue is that the script outputs all the correct coordinates as per Screen(1) but the click actually happens on Screen(0)!

Revision history for this message
Tak Eda (takeda) said :
#4

Is this an underlying bug in Sikuli ( script fails if it runs on anything but Screen(0)) or can I explicitly pass Screen(1) to the click function?

Revision history for this message
RaiMan (raimund-hocke) said :
#5

what version of Sikuli?

Revision history for this message
Tak Eda (takeda) said :
#6

SikuliX Setup Build: 1.1.0-Beta1 2014-05-30-18

Revision history for this message
Tak Eda (takeda) said :
#7

@RaiMan, do you need further information to help troubleshoot this?

I noticed you fixed this in version 0.9 so is this a regression?

I can definitely help you troubleshoot and (perhaps) FIX this!

Tell me where to look and how to turn tracing on for the actual click function (the info messages show the correct coordinates where the click SHOULD go but the actual click happens on the other screen)

Thanks again for looking into this.

Can you help with this problem?

Provide an answer of your own, or ask Tak Eda for more information if necessary.

To post a message you must log in.