← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #222645]: onAppear, while loop and observe timeout

 

Question #222645 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/222645

    Status: Open => Answered

RaiMan proposed the following answer:
onAppear() is only a preparation method and not useable in functional
contest: it registers the image to appear and the given handler at the
region object (in your case SCREEN, the constant object for the primary
screen).

The work is done by observe, which checks the registered on...-events
based on the ObserveScanRate and triggers the handlers appropriately.

So the onAppear() has to be outside the while loop, since it is
something static.

But if I understand right, this simply would do it:

with findAll ("images_on_main_pages") as mm:
    while mm.hasNext():
        click ("image_link_to_subpage")
        if exists("close_subpage", 20)
            click(getLastMatch())
            mm.next()
            continue
        print ("do something else if close_subpage not appear in 20sec")
        mm.next()

no observe at all ;-)

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.