← Back to team overview

sikuli-driver team mailing list archive

[Question #691528]: Perform action on image when it appears dynamically without using sleep

 

New question #691528 on Sikuli:
https://answers.launchpad.net/sikuli/+question/691528

We have an application where the expected image will appear faster sometimes and delays sometimes(may take too long time or less)
I am using eclipse with java
Initially tried with thread.sleep(time) if the image appears faster execution is taking more time.
Pattern pattern = new Pattern("Image location");

screen.click(pattern);
 
Thread.sleep(60000);
//wait for next image to appear
Tried with below approaches but still not working
Approach1:
Screen screen = new Screen();
Pattern pattern1 = new Pattern("Image location ");
if(exists(pattern("C:\\1Winium\\Screenshots\\Capture2.png").exact(),3600));

Approach2:
screen.setAutoWaitTimeout(900000);
As soon as the image appears action is not performed but it is waiting again

Approach3:
while(screen.exists("Image location ") != null);
When the application will open it takes time for image to appear and hence this will fail.

Approach4:
screen.wait("Image location");
Again, this will say image not found since its tries to find image before it appears

Approach5:
screen.wait(pattern1,89000);
This is working similar to thread.sleep(89000)
I am new to sikuli Please help in finding a solution as soon as the image appears it should perform operation and should not wait till the time specified. Something like “explicit Wait” that we use in selenium. To avoid unnecessary delay while execution.
Referred below links:
https://answers.launchpad.net/sikuli/+faq/1607
https://answers.launchpad.net/sikuli/+question/657348
https://stackoverflow.com/questions/47887736/sikuli-ide-command-waitimage-not-waiting-for-image-to-appear-before-script-c
and referred few more . 


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