[英]onappear in sikuli - java
I am looking for the application of "onappear" along with click, wherein I want to click on the captured GUI once it appears. 我正在寻找“ onappear”和单击的应用程序,其中我想在捕获的GUI出现后单击它。
I know this can be done using "wait" and then using "click", but then I have to statically feed in the wait time, which I wish to avoid. 我知道可以先使用“等待”再使用“单击”来完成此操作,但随后我必须静态输入等待时间,这是我希望避免的时间。
Is there a way to use "onappear" and "click" together? 有没有一种方法可以同时使用“出现”和“单击”? If not can somebody please come up with a solution to wait for a GUI and clicking it thereafter (dynamic wait)? 如果不能,请提出一个解决方案,等待GUI,然后单击它(动态等待)?
I can't think of a built-in solution, but you could write your own simple definition to do it. 我想不出内置的解决方案,但是您可以编写自己的简单定义来实现。 This doesn't use onAppear specifically, but I think it might accomplish your purpose. 这没有专门使用onAppear,但是我认为它可以实现您的目的。
In python: 在python中:
def waitClick(myImage):
time = 0
while time < 30:
if not myRegion.exists(myImage):
wait(.5)
time += 1
else:
click(myImage)
break
This will check every half second for your image to appear, for 15 seconds. 这将每隔半秒检查一次您的图像,显示时间为15秒。 When it does appear, it will click the image, and then terminate the loop. 当它确实出现时,它将单击该图像,然后终止循环。 Would something like this be helpful? 这样的事情会有所帮助吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.