ObjectRepositoryUtil Object > Methods > AddObject Method


Adds the specified object to the object repository under the specified parent object.

Important Information

You can use this method to add a copy of an object that you retrieved from a different object repository.

Tip: Before adding an object to the object repository, you can modify its description properties using the SetTOProperty method.  For more information about this method, see the Unified Functional Testing Object Model Reference.


object.AddObject(Object, Parent, [Name])

Syntax Details

objectAn expression evaluating to an object of type ObjectRepositoryUtil.
ObjectRequired. An Object object.

The object to add to the object repository. 

Tip: You can use the GetObject, GetObjectByParent or Item methods to retrieve the test object to use as this argument value.

ParentRequired. A Variant value.

The parent object.

You can specify the parent test object's IDispatch pointer or its full path as it appears in the Editor, for example, Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").

If you want to add the object as a top-level test object, or you are adding a checkpoint or output value object, specify NULL as the Parent argument value.

NameOptional. A Variant value. The name to use for the object in the object repository. If you do not specify a name, one of the object's property values is used as its name (The property used depends on the object class. In most cases, the "name" or "value" property is used).

Return Type

A Variant value.  The name of the object as saved in the object repository.