Item Method (Web Objects)

Applies to TestComplete 15.68, last modified on October 16, 2024
This method is obsolete. By default, it is not available. See the Remarks section below.

Description

The Item method is used to obtain a program object providing scripting access to a web page element.

The method is added to all program objects that are collections of objects providing scripting access to web page elements.

Declaration

TestObj.Item(SourceIndex)

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

Applies To

The method is applied to the following object:

View Mode

To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.

Parameters

The method has the following parameter:

SourceIndex

The value used to address the element.

A web page element can be addressed by its id, sourceIndex properties (for Web page elements, these properties hold the same value) or by the element’s name. The element’s name is the value of the element’s Name or Id attributes. You can obtain it using the NativeWebObject.name property of the program object corresponding to the element. It is also the value of the string specified in the parenthesis of the item’s node name, which you can see in the Object tree of the Object Browser.

To specify the parameter, use the name that is displayed for the element in the Object Browser.

To specify the element’s name, you can use the asterisk (*) and question mark (?) wildcards. The asterisk corresponds to the string of any length, the question mark - to any single character.

Result Value

The specified page element.

If the specified element does not exist, the method returns a stub object and posts an error message to the test log.

If your project is configured not to stop the test run whenever an error is posted, you can determine whether the method returns an existing element by checking the Exists property of the returned object. If Exists returns False, the page does not contain the specified element.

Remarks

This method is obsolete. It is supported for the backward compatibility only. It is available only if one of the obsolete Tree models is enabled.

See Also

WaitItem Method (Web Objects)
Web Object
Classic Web Testing

Highlight search results