|Information in this topic applies to web and hybrid mobile applications.|
You can use the Frame method to get access to the object that provides scripting access to a frame on a tested web page that is displayed in a stand-alone web browser or in an embedded browser control. The method can be added to various objects. See the Applies To section below.
For hybrid Android applications: Android 4.1 and later restricts access to the contents of frames of pages loaded from local files. To work with controls in these frames, you need to enable certain settings. See below.
|TestObj||A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section|
The method applies to the following objects:
Page(...) object or the parent Frame object.
To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.
The method has the following parameter:
Specifies the value used to address the frame.
A frame can be addressed by its
sourceIndex properties (for Web page elements, these properties hold the same value) or by the frame’s name. The frame’s name is the value of the frame’s Name or ID attributes. You can obtain it using the
NativeWebObject.name property of the program object corresponding to the frame. It is also the value of the string specified in the parenthesis of the frame’s node name, which you can see in the Object tree of the Object Browser.
For instance, for the frame displayed on the following image, you can use the string “iframeResult” as the SourceIndex parameter:
To specify the frame’s name, you can use the asterisk (*) and question mark (?) wildcards. The asterisk corresponds to a string of any length, the question mark corresponds to any single character.
The object that corresponds to the specified frame.
If the specified frame 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 the object corresponding to an existing frame by checking the
Exists property of the returned object. If
Exists returns False, the page does not contain the specified frame.
For hybrid Android applications: Android version 4.1 and later restricts access to the contents of frames of pages loaded from local files. To work with controls in these frames, you need to enable the Update WebView settings to allow access to frame elements option in your TestComplete project’s properties (see Project Properties - Hybrid Mobile Options).
Note that if this option is enabled, TestComplete reloads the page that is displayed in a WebView when you access a frame for the first time. If you want to avoid reloading for some reason, you can keep the setting disabled and use the following script code to change the properties of the tested WebView control: