White Framework Wait Commands - Codoid
Select Page
Codoid Blog

White Framework Wait Commands

Irrespective of the business that your client is in, marketing is an integral part of their operations. In fact, in this day and age of social.

The White framework does not send an action until a window has entered the idle state after the previous action. In that case, White framework waits automatically if a window is busy.

But how to wait for an element or a particular condition? How to avoid Thread.sleep during automation script development? In White, we can write our synchronization points. In this article, we will show you White framework waiting techniques and commands which are being used in all our desktop automation testing projects at Codoid.

Wait Based On HourGlass

Using WaitBasedOnHourGlass property (default value true), you can configure wait based on presence of hour glass.

CoreAppXmlConfiguration.Instance.WaitBasedOnHourGlass = true;
[/code]
WaitTill Method

WaitTill is one of the methods for Window object. You can use this method to wait until the certain condition matches.

Label lbl = window.Get

In the above example, the script waits until the label field visibility=true. The default wait time is 5000 milliseconds.

You can also change the Default wait time by setting BusyTimeout property as shown below.

CoreAppXmlConfiguration.Instance.BusyTimeout = 10000;
[/code]
WaitWhileBusy method
Window window = application.GetWindow("Calculator");
window.WaitWhileBusy();
[/code]

WaitWhileBusy method makes your script wait until the window is busy. Note: You no need to call this method for every action as it is called automatically at the end of every action.

Wait Hook

If you want to write your custom delay and the written custom code needs to be called after every action, then you can use IWaitHook interface as shown below.

public class CustomWait : IWaitHook
{
public CustomWait()
{
CoreAppXmlConfiguration.Instance.AdditionalWaitHook = this;
}

// Implementation of the IWaitHook interface
public void WaitFor(UIItemContainer uiItemContainer)
{
...
}
}
[/code]

Written By

Submit a Comment

Your email address will not be published. Required fields are marked *


The White framework does not send an action until a window has entered the idle state after the previous action. In that case, White framework waits automatically if a window is busy.

But how to wait for an element or a particular condition? How to avoid Thread.sleep during automation script development? In White, we can write our synchronization points. In this article, we will show you White framework waiting techniques and commands which are being used in all our desktop automation testing projects at Codoid.

Wait Based On HourGlass

Using WaitBasedOnHourGlass property (default value true), you can configure wait based on presence of hour glass.

CoreAppXmlConfiguration.Instance.WaitBasedOnHourGlass = true;
[/code]
WaitTill Method

WaitTill is one of the methods for Window object. You can use this method to wait until the certain condition matches.

Label lbl = window.Get

In the above example, the script waits until the label field visibility=true. The default wait time is 5000 milliseconds.

You can also change the Default wait time by setting BusyTimeout property as shown below.

CoreAppXmlConfiguration.Instance.BusyTimeout = 10000;
[/code]
WaitWhileBusy method
Window window = application.GetWindow("Calculator");
window.WaitWhileBusy();
[/code]

WaitWhileBusy method makes your script wait until the window is busy. Note: You no need to call this method for every action as it is called automatically at the end of every action.

Wait Hook

If you want to write your custom delay and the written custom code needs to be called after every action, then you can use IWaitHook interface as shown below.

public class CustomWait : IWaitHook
{
public CustomWait()
{
CoreAppXmlConfiguration.Instance.AdditionalWaitHook = this;
}

// Implementation of the IWaitHook interface
public void WaitFor(UIItemContainer uiItemContainer)
{
...
}
}
[/code]