|The information below concerns legacy mobile tests that work with mobile devices connected to the local computer. In new cloud-compatible mobile tests, the test engine recognizes controls by their accessibility info.
TestComplete can recognize Android WebView controls in Android applications. It provides special properties and methods that let you retrieve the controls data and simulate user actions on the controls (see below).
The Android WebView control is a wrapper object for the embedded WebKit rendering engine. Many mobile web browsers and hybrid applications (native Android applications that contain an embedded web browser) use WebView controls to display online or offline web pages.
Web pages that are opened in an embedded browser are represented as child Page objects of the respective Web View object.
In order for TestComplete to be able to work with Android WebView controls, the following requirements must be met:
You must have an active license for the TestComplete Mobile module.
Your Android device (or virtual machine), the Android application under test and TestComplete must be prepared for testing as it is described in the topics of the Preparing for Testing Android Applications (Legacy) section.
The control’s class name must be specified in the Android Controls | Web view group of your project’s Object Mapping options. By default, this group contains the following item:
To command TestComplete to recognize instances of the specified class’s descendants as Android WebView controls, select the Derived Classes check box next to the control’s class name.
You can also command the test engine to recognize custom controls as Android WebView controls. See below for information about this.
If you experience issues when working with the controls, select File > Install Extensions from the TestComplete main menu and check whether the plugin is active. (You can find the plugin in the Mobile group.) If the plugin is not available, run the TestComplete installation in the Repair mode.
Recognizing Custom Controls
To command TestComplete to recognize your custom controls as Android WebView controls:
Open your project’s Object Mapping options.
Add the control’s class name to the Android Controls | Web view group.
If you do not know the control’s name, you can ask the control’s developers, or you can view the control’s
JavaFullClassNameproperty in the Object Browser panel. As an alternative, you can click Add From Screen and select your custom control on screen. TestComplete will retrieve the control’s class name and add it to the selected mapping group automatically. For detailed information, see Object Mapping.
Once the control is mapped, it gets all the properties, methods and actions specific to the Android WebView control.
If the specified custom control does not fit the control’s type, then it may not properly respond to commands that TestComplete sends, so recording or playing back user actions over the tested control will cause errors.
When testing Android WebView controls, you can use properties and methods specific to these controls, as well as properties and methods that TestComplete applies to tested objects, onscreen objects and window objects. For the full list of available properties and methods, see the following topics:
When your Android device activates the onscreen keyboard, the WebView control zooms and scrolls its contents, making it “closer” to a user. Some Android devices (for example, Nexus 6) may not notify TestComplete about this zooming and scrolling properly. As a result, TestComplete will not be able to correctly calculate coordinates of subsequent touch actions to be simulated, and your test will fail.
To work around this issue, you can configure your device to use the TestComplete Android Agent keyboard instead of its native onscreen keyboard during the testing.
To learn more about the TestComplete Android Agent keyboard, see Simulating Local Symbol Input (Legacy).
To learn about other issues that may occur when testing Android applications, see Possible Issues With Android Applications (Legacy).
WebViewcontrol belongs to a
ScrollViewcontrol in your tested Android application, it may take a lot of time for TestComplete to access internal properties and methods of the
WebViewcontrol. In addition, the content of a
WebViewcontrol that belongs to a
ScrollViewcontrol may be scrolled incorrectly.
To avoid these issues, we recommend that you ask your application developers to use another container for the
WebViewcontrols or to use the
WebViewcontrol’s own functionality for scrolling.