FindFailed why?

Asked by Varnostnik on 2018-05-06

Im trying to do something really simple here.
http://shrani.si/f/2Y/zh/21lWGy7v/failed.jpg

I though this reads like

1. if picture exist, click it, if not go to line 2
2. wait 10 seconds
3. if picture exist, click it, if not go to line 4
4. wait 4 seconds.
and so on.

But I get wired find failed errors all the time. Clear sold and relist are dynamic pictures, meaning they dont always show up.

The script works fine if all picture show up, but fails as soon as line 5 and 7 pictures are missing.

[error] RobotDesktop: checkMousePosition: should be L(715,74)@S(0)[0,0 1920x1080] but after move is L(716,73)@S(0)[0,0 1920x1080] Possible cause in case you did not touch the mouse while script was running: Mouse actions are blocked generally or by the frontmost application. You might try to run the SikuliX stuff as admin.

[log] CLICK on L(715,74)@S(0)[0,0 1920x1080] (535 msec)

[log] CLICK on L(1282,741)@S(0)[0,0 1920x1080] (532 msec)

[error] script [ webapp_relist_all_v2 ] stopped with error at line --unknown--
[error] Error caused by: Traceback (most recent call last): File "F:\scripts\webapp_relist_all_v2.sikuli\webapp_relist_all_v2.py", line 5, in <module> exists,click("1525601189398.png") Line 2782, in file Region.java
at org.sikuli.script.Region.wait(Region.java:2782)
at org.sikuli.script.Region.find(Region.java:2329)
at org.sikuli.script.Region.getLocationFromTarget(Region.java:3238)
at org.sikuli.script.Region.click(Region.java:3736)
at org.sikuli.script.Region.click(Region.java:3721)
at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
org.sikuli.script.FindFailed: FindFailed: 1525601189398.png: (78x37) seen at (1539, 197) with 1.00 in S(0)[0,0 1920x1080] E:Y, T:3.0 Line 2782, in file Region.java

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2018-05-06
Last query:
2018-05-06
Last reply:
2018-05-06
Best RaiMan (raimund-hocke) said : #1

Where did you get the info, that
exists,click(image)
is a correct syntax?

IMHO it should read:
if exists(image): click()

see the docs.

RaiMan (raimund-hocke) said : #2

the magic behind:

exists,click(image)

defines a list with 2 elements (the function object exists (does nothing) and the result of the function call click(image))

since only the second list element does something, the line works, if the image exists, but fails if not.

since the list is not assigned, it is simply lost, when the next line is executed.

Varnostnik (sawyerbox) said : #3

thank you.
This works much better. :D

Varnostnik (sawyerbox) said : #4

Thanks RaiMan, that solved my question.