WaitXFObject Method

Applies to TestComplete 14.70, last modified on April 22, 2021

Description

Use this method to pause the script execution until the specified control of the tested Xamarin.Forms application becomes available to TestComplete. The method returns a program object that provides a scripting interface to the specified control. The resulting object contains methods and properties defined in the application code as well as methods, properties and actions provided by TestComplete.

Declaration

TestObj.WaitXFObject(ControlNameTimeout)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
ControlName [in]    Required    String    
Timeout [in]    Required    Integer    
Result Object

TestObj.WaitXFObject(ClassNameControlTextTimeout)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
ClassName [in]    Required    String    
ControlText [in]    Required    String    
Timeout [in]    Required    Integer    
Result Object

TestObj.WaitXFObject(ClassNameControlTextIndexTimeout)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
ClassName [in]    Required    String    
ControlText [in]    Required    String    
Index [in]    Required    Integer    
Timeout [in]    Required    Integer    
Result Object

Applies To

The method is applied to the following object:

A process object corresponding to the tested Xamarin.Forms application, all Xamarin.Forms test objects.

View Mode

This method is not displayed in the Object Browser panel.

Parameters

The method has the following parameters:

ControlName

The name of the object as it is specified by the developers in the application’s source code. This is the value of the object’s XFControlName property.

If the name is unavailable (for example, the application developers did not specify it), use the second implementation of the method to address the desired object.

ClassName

The object's class name as it is specified in the application's source code. Specify a short class name, for instance, Button, rather than Xamarin.Forms.Button. You can use wildcards (* and ?).

ControlText

The text of the onscreen object. You can use wildcards (* and ?).

Index

The index of the object among its sibling objects with the same class name and text.

The Index parameter is used only if an object contains two or more child objects that have the same class name and caption. It is used to distinguish these objects from each other. The first found object has an index of 1, the second -  2 and so on.

If there is only one child object with the specified class name and caption, index should not be specified. To decide whether the index should be used, explore your application in the Object Browser panel and use the naming format that is used by the panel.

Timeout

The number of milliseconds to wait until the specified object becomes available. If Timeout is 0, the method returns immediately. If Timeout is -1, the wait time is infinite.

Note: The Timeout value is not strict, and if the tested application is busy, TestComplete can wait for the object for a longer period than is specified by the parameter. This can be caused by the following:

A call to any WaitXXXObject method causes the object tree to refresh. To update object data, TestComplete may call some of the object’s native methods that are accessible only from the application’s thread. When the thread is busy, TestComplete tries to call those methods during some pre-defined time (one second) thus delaying the refresh. There can be several attempts to get the object data, which may result in a noticeable difference from the Timeout value.

Result Value

The object that provides a scripting interface to a control in the tested Xamarin.Forms application. If TestComplete cannot access the specified object (for example, the object does not exist), WaitXFObject will return an empty stub object. To determine whether WaitXFObject returns a valid object, use the Exists property of the returned object. If this property returns False, then the returned object is a stub object, and the call to WaitXFObject was not successful.

Remarks

If you use two parameters, TestComplete uses the first implementation of the WaitXFObject method and the first parameter as the object’s name. If you use three or four parameters, TestComplete uses the second or third implementation respectively.

The object returned by the WaitXFObject method contains methods and properties defined in the application code, as well as methods, properties and actions provided by TestComplete. The returned object may hold two or more methods and properties that have the same name. If you call such a method or property, a naming conflict will occur. To avoid this and to specify which method or property is to be called, use the NativeXFObject namespace.

The XFObject method is available for objects only in Xamarin.Forms applications, and only if you have an active license for the TestComplete Mobile module and the Android Support and iOS Support plugins are enabled in TestComplete.

See Also

XFObject Method (Xamarin.Forms Objects)
About Xamarin.Forms Application Testing
Addressing Objects in Xamarin.Forms Applications
Object Browser Naming Notation
Using Namespaces
About Open Applications

Highlight search results