Mobile Development 4 min read

Implementing Sequential UI Traversal for Android Apps Using UIAutomator on the 360 Open Testing Platform

This article explains how to perform ordered UI traversal of an Android application with UIAutomator on the 360 Open Testing platform, covering required parameters, a seven‑step implementation process, UI change listening via AccessibilityService, element dumping, sorting, comparison methods, interaction automation, and termination conditions.

360 Quality & Efficiency
360 Quality & Efficiency
360 Quality & Efficiency
Implementing Sequential UI Traversal for Android Apps Using UIAutomator on the 360 Open Testing Platform

For testers, UI traversal tools like Monkey and UICrawler are common, but performing a sequential traversal of an app requires a custom approach; this guide demonstrates how to achieve that using UIAutomator on the 360 Open Testing platform.

Required parameters: package name, launch activity, traversal end class, traversal duration, total steps, login account, and password.

Implementation steps:

Launch the target APK.

Add a UI change listener (AccessibilityService) to monitor window state, content changes, and view clicks.

Dump UI component elements that can be interacted with (clickable, scrollable, etc.).

Sort the dumped elements, prioritizing those visible on screen or within view pagers.

Compare UI elements using MD5 hashes or image similarity to identify the current target.

Operate on the selected UI component (click, swipe) and capture screenshots.

Stop the traversal when the configured time or step count is reached, returning to the device home screen.

Detailed explanation:

The listener is implemented via an AccessibilityService that captures three types of events: TYPE_WINDOW_STATE_CHANGED , TYPE_WINDOW_CONTENT_CHANGED , and TYPE_VIEW_CLICKED . Initial checks verify that the package name and class name are correct, and that the soft keyboard is hidden before proceeding.

During dumping, only elements that are actionable (clickable, scrollable) are retained. Elements are filtered to ensure they lie within the visible screen bounds, and lists are created for further processing.

Comparison of elements is performed in two ways: (1) MD5 hash comparison between stored strings and the current UI snapshot; (2) image similarity comparison, where each click triggers a similarity check and matching parts are used to generate new element lists.

After a successful match, the script interacts with the UI component, captures a screenshot, and proceeds to the next step. The traversal ends when both the elapsed time and the number of steps match the configured limits.

Effect: Screenshots showing the successful execution of each step are provided.

AndroidUI Automationmobile testingAccessibilityServiceUiAutomator360 Open TestingApp Traversal
360 Quality & Efficiency
Written by

360 Quality & Efficiency

360 Quality & Efficiency focuses on seamlessly integrating quality and efficiency in R&D, sharing 360’s internal best practices with industry peers to foster collaboration among Chinese enterprises and drive greater efficiency value.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.