简体   繁体   中英

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.

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)?

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.

In 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. When it does appear, it will click the image, and then terminate the loop. Would something like this be helpful?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM