← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #658728]: How to work around an occasional image

 

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

    Status: Open => Answered

Manfred Hampl proposed the following answer:
If your primary logic is more complicated that just [:wait - click:], then I would like to go back to my recommendation with an observer.
It seems that there was an error in my first proposal; apparently there is old code in an example of the documentation in http://sikulix-2014.readthedocs.io/en/latest/scripting.html?highlight=observer#Settings.ObserveScanRate

Try with something like

def myHandler(e):
         click("image1.5.png")
onAppear("image1.5.png", myHandler)
observeInBackground(FOREVER)

wait("Image_A.png", FOREVER)
click("Image_A.png")
wait("Image_B.png", FOREVER)
click("Image_B.png")
wait("Image_C.png", FOREVER)
click("Image_C.png")
wait("Image_D.png", FOREVER)
click("Image_D.png")
wait("Image_E.png", FOREVER)
click("Image_E.png")
type("username")
click(in the password field)
type("password")
wait("Image_F.png", FOREVER)
click("Image_F.png")

etc.



Maybe the following approach works:

Split the logic into two parts:
 1. the main logic, as already programmed by you

wait("image1", FOREVER)
 click("image1")
 wait("image2", FOREVER)
 click("image2")

and
 2. additional logic that runs when that image1.5 shows up
 For this you can let an observer run in the background.


(part 2 has to go before part 1)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.