sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #11158
[Question #200354]: findAll function is not returning any results though match preview indicates it should
New question #200354 on Sikuli:
https://answers.launchpad.net/sikuli/+question/200354
I am currently writing a script where the object is to find a certain image on a page. Once the image is found, the page resets and it needs to find this image again. Because the image is quite small, sikuli will sometimes interpret other graphical elements as being the image. As such, I need to find a way to prevent my mouse from clicking the same place over and over.
In order to avoid this occuring, this is how my script was built (the region is declared earlier):
x = Large.find(Found) #finding the first searchable in level
y = x #storing position of searchable for later comparison
click(x)
sleep(1)
while Large.exists(Found): #searching for hit boxes
x = Large.find(Found) #current new position
print(x,y)
if x == y:
with Large.findAll(Found) as m:
while m.hasNext():
x = m.next()
y = x #resetting the value of y
click(x)
print(x,y)
else:
x = Large.find(Found)
Large.find(Found)
y = x #resetting y value to new x position
click(x)
sleep(1)
else:
wait("arsLu5LL_.png",10)
click("_JJ11i.png")
The issue that I am encountering is that the findAll() in line 14 won't always find items even when the matching preview indicates that some should be found. It also generally does not find the proper amount of matches. The following error appears in the output:
[error] Error message: Traceback (most recent call last):
File "C:\Users\mpoulin\AppData\Local\Temp\sikuli-tmp6720749050519535256.py", line 15, in
if x == y:
Line 30, in file C:\Users\mpoulin\AppData\Local\Temp\sikuli-tmp6720749050519535256.py
at org.sikuli.script.Region.handleFindFailed(Region.java:420)
at org.sikuli.script.Region.findAll(Region.java:459)
at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
org.sikuli.script.FindFailed: FindFailed: can not find 1339174675949-1.png on the screen.
Line 30, in file C:\Users\mpoulin\AppData\Local\Temp\sikuli-tmp6720749050519535256.py
I'm not sure if the error is in the coding or if it's an issue with the pattern recognition.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.