Is there any wait until available in Sikuli

Asked by Abilashkar

HI Is there any wait until available in sikuli
i have a screen on my desktop application when i click on a button loading image will be displayed. i need to wait unitl that loading image disappears. Is there any solution to wait until loading image gets disappear.

Note : It will take long time to disappear

Thanks in advance

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1
Revision history for this message
TestMechanic (ndinev) said :
#2

1. In most cases load indicators are not static images but animations. This may be issue for you
2. If waiting too long you may consider less cpu intensive approach than waitVanish. for example loop with exists() and sleep()

Revision history for this message
Abilashkar (abilashkar) said :
#3

https://sikulix-2014.readthedocs.io/en/latest/region.html#Region.waitVanish

WaitVanish tried not effective before vanishing the image control is getting moved to another line

Revision history for this message
Abilashkar (abilashkar) said :
#4

any solution ?

Revision history for this message
Abilashkar (abilashkar) said :
#5

private Pattern waitForMoment;
private Region window;
screenWithloading =new Pattern(TestProperties.path("screenWithLoading.PNG"));
screenWithoutLoading = new Pattern(TestProperties.path("FSMScreen.PNG"));

window = getDriver().wait(screenWithloading );
  waitForMoment = new Pattern(TestProperties.path("WaitForMomentsImage.PNG"));
  window.waitVanish(waitForMoment);

window = getDriver().wait(screenWithoutLoading );
  window.click(typeBtn);

here on above code its not waiting till the image is getting vanished

Revision history for this message
Manfred Hampl (m-hampl) said :
#6

Maybe a timing issue.

How long does it take for the images to appear and disappear, and how does the screen look like in the time between?

You wait until "screenWithLoading" appears, and then wait until "waitForMoment" vanishes.
Are they shown at the same time?
If not, you should first wait until "waitForMoment" appears, and only then wait for it to vanish, or put a short "sleep" in between to make sure that "waitForMoment" is really shown on screen.

Another possible error in your script could be that the "waitForMoment" picture stays on the screen longer than the maximum waiting time (value of setAutoWaitTimeout(), default 3 seconds).

Revision history for this message
Abilashkar (abilashkar) said :
#7

How long does it take for the images to appear and disappear, and how does the screen look like in the time between?
Reply: some times it take 30 min some times it take 1 hr

Are they shown at the same time?
Yes In that "screenWithLoading" image contains the loading image "waitForMoment"

Now im using
CTL_TIMEOUT=15;
getDriver().wait(CTL_TIMEOUT);

im using this above wait times 39 ;( ;(

Revision history for this message
Manfred Hampl (m-hampl) said :
#8

If you want to wait for the "waitForMoment" image to disappear, and if this might take up to an hour, then a wait time of 15 seconds does not really help.
There is an optional second parameter to waitVanish, being the maximum wait time.
Maybe something like
window.waitVanish(waitForMoment, FOREVER);
works as desired (eventually experiment also with different values for scan rate, or try TestMechanic's recommendation in comment #2)

Revision history for this message
Abilashkar (abilashkar) said :
#9

Ok Let me try this and update Thanks Manfred

Can you help with this problem?

Provide an answer of your own, or ask Abilashkar for more information if necessary.

To post a message you must log in.