Possible Issues With Hybrid Mobile Applications (Legacy)

Applies to TestComplete 15.46, last modified on January 09, 2023
The information below concerns legacy mobile tests that work with mobile devices connected to the local computer. For new mobile tests, we recommend using the newer cloud-compatible approach.

You may come across some problems when testing hybrid mobile applications. This topic explains the cause of the possible issues and offers possible workarounds.

Asynchronous Test Actions

Actions performed against web controls are asynchronous. This means that a method or operation sends a command to a device and TestComplete does not wait until the device completes the operation, it goes to the subsequent script statements or keyword-test operations. This may cause problems if the command starts time-consuming actions on the device, as the subsequent script statements or operations may depend on the result of the previous command.

To pause the script execution for some time, you can use the aqUtils.Delay method or the Delay operation. You can also use the Wait method to pause the test run until the application is in the needed state.

XPath Expressions Do Not Find Objects in Nested Frames

Due to the way XPath expressions work with WebViews, it is impossible to use them to find objects in nested frames on a web page. However, you can use XPath expressions within a frame to find its child frame element and work with it.

Offscreen Objects Are Not Found in Some Custom Scroll Containers

TestComplete automatically scrolls to offscreen objects before simulating actions against them. However, some custom scroll containers do not support automatic scrolling. In this case, the test will fail to find the needed object.

If this happens in your test, modify it to scroll to the needed control using the Device.Drag method.

HTML5 Support Limitations

HTML5 support for hybrid mobile applications has some limitations. For example, you cannot access the data object model of a web page, or access KEYGEN elements. For a full list of limitations, see the HTML5 Support in Hybrid Mobile Applications topic.

Hybrid Android Applications Issues

Common Android Issues

Hybrid Android applications are Android applications with the WebView control. See the Android Possible Issues topic for information on issues common for all Android applications.

Popup Closes When Performing Test Actions

On devices with Android 4.3 and earlier, TestComplete cannot access web page elements while a popup of the Select control is displayed. If you try to work with web page controls while a popup is displayed, it will be closed. On some devices (for example, Motorola XT897), you may need to restart the application to display the popup again.

If possible, use the TouchItem method to select a value in the control.

Touches Affect Nearby Controls

If several web page elements are located close to each other, a touch simulated on one element may affect another. If possible, move the web page elements apart to avoid the issue. You can also add parameters for the Touch action to simulate touches at coordinates that are far enough from other elements.

Unable to Input Local Symbols During Test Recording

On devices running Android 4.0.4, the TestComplete Android Agent keyboard cannot input local (national) symbols into text edit controls on web pages during test recording.

To simulate input of local symbols, you may need to add appropriate operations to your test manually. See Creating Tests for Hybrid Mobile Applications Manually (Legacy).

Hybrid iOS Applications Issues

Issues With WKWebView Controls

  • Actions over WKWebView controls are not recorded.TestComplete cannot record actions against web controls displayed in WKWebView. If your application uses WKWebView controls, you can create tests manually. If you need to record tests on your iOS hybrid applications, use applications with UIWebView controls.

  • Objects within WKWebView frames are not recognized. By default, TestComplete cannot access the contents of these frames residing on pages loaded from local files. To enable access to the frame contents on local pages, change the WKWebView setting in your application before testing:

    Objective-C

    [webView.configuration.preferences setValue:@(YES) forKey: @"allowFileAccessFromFileURLs")]

    Swift

    webView.configuration.preferences.setValue(true, forKey: "allowFileAccessFromFileURLs")

JavaScript Popups Are Not Recognized

TestComplete does not recognize JavaScript popups in hybrid iOS applications. This means that it is impossible to play back tests that interact with controls in popups or close a popup reliably. If possible, avoid testing of web pages that display popups.

Manually Created Tests Cannot Work With Local Pages

Every time you install an iOS application, your device creates a unique ID. TestComplete uses this ID as part of the identifier of local web pages. If you reinstall your application, the tests you created manually will try to use the old identifier.

The web page identifier depends on the iOS version. If you run your tests on different versions of iOS, the tests you created manually will use a wrong identifier.

In both cases, your tests will fail. To make the tests you create manually identifier-independent, use Name Mapping or replace the changeable part of the identifier with an asterisk (*):

JavaScript, JScript

Mobile.Device("iPad").Process("UIWebViewTestedApp").Window(0).WebView().Page("file:///*/index2.html").Panel(0).Link(0).Touch();

Python

Mobile.Device("iPad").Process("UIWebViewTestedApp").Window(0).WebView().Page("file:///*/index2.html").Panel(0).Link(0).Touch();

VBScript

Mobile.Device("iPad").Process("UIWebViewTestedApp").Window(0).WebView().Page("file:///*/index2.html").Panel(0).Link(0).Touch

DelphiScript

Mobile.Device('iPad').Process('UIWebViewTestedApp').Window(0).WebView().Page('file:///*/index2.html').Panel(0).Link(0).Touch();

C++Script, C#Script

Mobile["Device"]("iPad")["Process"]("UIWebViewTestedApp")["Window"](0)["WebView"]()["Page"]("file:///*/index2.html")["Panel"](0)["Link"](0)["Touch"]()

See Also

About Testing Android Applications (Legacy)
Testing Android Applications (Legacy)

Highlight search results