Created On:  21 April 2011
There are a number of ways in which the existence of an Open Agent window/control can be determined using Silk Test.

Silk Test Classic 4Test:
If a window declaration is recorded/created then the Exists method will work fine and return true or false based on whether the said window was present within the application under test.

However if the syntax Desktop.Find("//SomeLocator").Exists() is being used and the window does not exist, SilkTest will generate a runtime error stating that it was unable to find the window. This occurs because the Find method is executed before the Exists method, therefore when the Find method failed to resolve the window an error is generated. A simple 4Test function can be created that will verify if a particular locator exists:

                [-] boolean VerifyExists(String sLocator, number nTimeout)
                         [ ] //if we cannot find the window in a particular time
                         [-] if(Desktop.Find(sLocator, {nTimeout, false}) == null)
                                  [ ] return false
                         [ ]
                         [ ] //the window was found
                         [ ] return true

Silk4J and Silk4NET:
Silk4J and Silk4NET provide and number of overloaded versions of the exists method, as follows:

                               - exists( )
                               - exists(String sLocator)
                               - exists(String sLocator, int Timeout)

From the Desktop instance or a parent window/control we can simply provide the locator string as part of the exists method.

For example in Silk4J:
                               boolean bExists = desktop.exists("//BrowserApplication", 10);

And in Silk4NET:
               Dim bExists As Boolean
               bExists = _desktop.Exists("//BrowserApplication")