Sikuli IDE命令等待(“图像”)不等待脚本继续之前出现的图像

问题描述 投票:0回答:2

我是Sikuli的新手,我正在用一个看起来像这样的非常简单的脚本来尝试它...

等待和点击cmds使用,他们正在工作,我面临的问题是wait("1513068228396.png",3600)没有等到图像出现,它等待大约10至15秒,并执行下一个cmd。我尝试包含一些日志,并尝试使用其他图像到相同的等待cmd,仍然是相同的结果。

wait("1513067960826.png",60)
click(Pattern("1513066493827.png").targetOffset(-106,2))
sleep(2)
click("1513066637741.png")
sleep(1)
click("1513599247108.png")
sleep(5)
print "wait for my image"

wait("1513068228396.png",3600)  # Facing issue in this line

print "found my image"

outputLog:

wait for my image
[debug] Region: find: waiting 3600.0 secs for 1513068228396.png to appear in R[0,0 1920x1080]@S(0)
[debug] Image: reused: 1513068228396.png (file:/D:/softwares/sikuli/SENINFO_V100R002C00SPC700.sikuli/1513068228396.png)
[debug] Region: checkLastSeen: not there
[debug] Region: find: 1513068228396.png has appeared at M[832,379 30x16]@S(S(0)[0,0 1920x1080]) S:0.70 C:847,387 [753 msec]
found my image

有任何建议如何解决这个问题。

sikuli sikuli-ide
2个回答
1
投票

也许该图像与屏幕中的某个区域具有相似性。您可以尝试将相似度设置为最高值:

wait(Pattern("some_image.png").similar(0.8),) # if you want the 80% of similarity
wait(Pattern("some_image.png").exact()) # if you want the 100% of similarity

另外,我鼓励你使用if exists而不是wait。如果图像不存在,Wait将结束程序:

if exists(Pattern("some_image.png").exact(),3600):
    click("some_image.png")

你可以找到模式文档here


0
投票

wait(pattern, 3600)相当于wait(pattern, FOREVER),它被描述为here并将无限期地等待该模式。如果像你的一样,唯一可以解释这种行为的是如果在屏幕上实际找到了模式,下面的行确认:

地区:发现:1513068228396.png出现在M [832,379 30x16] @S(S(0)[0,0 1920x1080])S:0.70 C:847,387 [753 msec]

也许这种模式出现在其他地方你错过了吗?或者相似性参数可能太低而另一个模式被识别。要检查是否尝试使用highlight(1)方法。

ptrn = find("pattern.png")
ptrn.highlight(1)

这可能会有所启发。

© www.soinside.com 2019 - 2024. All rights reserved.