[1.1.0] script stuck in click() or hover()

Asked by Luchung Chen on 2017-11-14

Hi, i have a problem about script running issue!

First, i post my executing environment:
    - OS: Microsoft Windows 7 Home Premium 6.1.7601 Service Pack 1 Build 7601
    - Sikuli: 1.1.0
    - Language: python 2.7.10

===============================================================================

OK, i ran my whole script and it seldom stuck in the following block:

if exists(imgList[6], 2): # imgList[6] is an image path
    orgReg = getLastMatch()
    nextReg = orgReg.offset(orgReg.w, 0)
    nextReg.click()

===============================================================================

When i encountered this issue at the first time, i added debug code to trace which line is root cause:

if exists(imgList[6], 2): # imgList[6] is an image path
    print "**** before getLastMatch() ****"
    orgReg = getLastMatch()
    print "**** between getLastMatch() and get new region ****"
    nextReg = orgReg.offset(orgReg.w, 0)
    print "**** between get new region and click() ****"
    nextReg.click()
    print "**** after click() ****"

I ran script and get the following output:

**** before getLastMatch() ****
**** between getLastMatch() and get new region ****
**** between get new region and click() ****

so script was stuck in click().

I replaced click() with hover(), script also seldom struck in hover().

===============================================================================

I do not know what factors can cause script struck in hover() or click().

Thanks.

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2017-11-16
Last reply:
2017-11-16
masuo (masuo-ohara) said : #1

I think that SikuliX 1.0.0 is no longer maintained.
So I recommend to use SikuliX 1.1.x.
https://launchpad.net/sikuli/sikulix/1.1.1

Luchung Chen (luchung) said : #2

Sorry, it's my fault. I use SikuliX 1.1.0 instead of 1.0.0. I has updated my question content. Thanks.

masuo (masuo-ohara) said : #3

I can't understand what "struck" is meant.
Does mouse click on an unexpected position?

Try print region "orgReg" and region "nextReg".
Try highlight region "orgReg" and region "nextReg".

if exists(imgList[6], 2):
     orgReg = getLastMatch()
     orgReg.highlight(1) # <---add
     print "orgReg:", orgReg # <---add

     nextReg = orgReg.offset(orgReg.w, 0)
     nextReg.highlight(1) # <---add
     print "nextReg:", nextReg # <---add

     nextReg.click()

Can you help with this problem?

Provide an answer of your own, or ask Luchung Chen for more information if necessary.

To post a message you must log in.