Mobile Development 10 min read

Automating ZuanZuan "Happy Delivery" Mini Program with Appium and Chrome Inspector

This article details the step‑by‑step setup and execution of automated testing for the ZuanZuan "Happy Delivery" WeChat mini‑program, covering debugging activation, process inspection, Chrome‑Inspector usage, Appium context switching, chromedriver compatibility, and best practices for building a maintainable mobile automation framework.

转转QA
转转QA
转转QA
Automating ZuanZuan "Happy Delivery" Mini Program with Appium and Chrome Inspector

Introduction

ZuanZuan Happy Delivery is a ZuanZuan‑incubated mini‑program that enables users to give away idle items directly to those in need with a fixed price, 24‑hour delivery, and no communication required. This article introduces the automation practice for sharing the mini‑program to WeChat group scenes.

Mini‑Program Automation Preparation

1. Enable the debugging feature in the WeChat mini‑program to obtain the context . Open the private chat page, enter http://debugx5.qq.com , click to jump to the X5 debugging page, select “Information”, and check “Enable TBS Kernel Inspector debugging”.

2. Mini‑program process (Appium chromeOptions ) configuration parameters.

When WeChat is not started, the process list under adb shell is:

After launching WeChat but before entering the mini‑program:

After starting the Happy Delivery mini‑program, the process list matches the previous one, indicating that WeChat loads mini‑program related content (top process is com.tencent.mm ).

When the mini‑program page is active, the top process becomes com.tencent.mm:tools (shortened to tools ), which corresponds to the chromeOptions value.

WebView Debugging Tool – Chrome‑Inspector

The URL chrome://inspect/#devices can identify WebView pages opened on the phone. Only the “Search” entry mini‑program is reliably visible; earlier versions allowed all entry points (search, wallet, etc.). Recommendation: use the Search entry for stable automation.

Appium Context Switching for Mini‑Program

1. Advantages and disadvantages of switching to WebView mode – Chrome‑Inspector shows more business scenarios and requires less maintenance compared to image‑based recognition.

2. How to switch to the desired element’s mini‑program page:

Switch to the element’s context (the top process name obtained earlier), then iterate over all handle s; the handle whose page_source contains the target element is the one to use.

To switch between multiple mini‑program pages, repeat the handle iteration and switch to the appropriate handle.

3. Not all devices can switch successfully, possibly due to bugs in the Appium framework.

Chromedriver‑WebView version compatibility is crucial. Three scenarios are described:

Device Android System WebView version higher than WeChat’s WebView (e.g., 59 vs. 57). Keeping only chromedriver 2.28 and 2.29 works; adding 2.30 causes errors.

Device WebView version lower than WeChat’s (e.g., 47 vs. 57). Keeping only 2.28 and 2.29 also leads to errors.

Device WebView version matches WeChat’s – automation should succeed with appropriate chromedriver.

Building the Mini‑Program Automation Framework

Principles: stay consistent with native and WebView implementations, ensure easy maintenance and case writing.

1. Store test cases in a dedicated test suite for the mini‑program.

2. Define elements with an additional key mini_program to align with native identifiers.

3. Store chromedriver binaries in the framework so that different execution machines can access the correct version.

4. Appium configuration parameters – note the chromedriverExecutableDir option, which is supported from Appium 1.8 onward. The framework automatically detects the Appium version and the device’s WebView version to set the correct parameters.

5. Compatibility of the execution environment – Uiautomator2 and Appium input method versions may vary across machines.

6. Execution supports command‑line parameters -w or --wechat .

7. Mini‑program initialization automatically disables mixed‑package files and pre‑operations on the host side for convenience.

8. Basic page operations include element existence checks, clicks, swipes, Chinese/English input, and page navigation.

Future Work

1. Provide a feasible automation solution for iOS mini‑programs (currently possible via reverse‑engineering the WeChat package, but risk of account bans).

2. Make case writing, debugging, execution, and result viewing more convenient for everyone.

Recommended Articles

1. Evolution of ZuanZuan App UI Automation

2. One‑Minute Overview of ZuanZuan Mini‑Program Testing System

automationWeChat Mini Programmobile testingappiumChromeDriverChrome Inspector
转转QA
Written by

转转QA

In the era of knowledge sharing, discover 转转QA from a new perspective.

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.