Skip to content

Introduction of Poco


Earlier we introduced Airtest, a test framework based on image recognition. With image recognition, we can already write most test scripts.However, in some special cases, such as for dynamic elements in games or apps, it is more difficult to locate them through image recognition. Therefore, our Airtest Project solution also provides Poco, another automation framework based on UI control search. Let's take an example to see how Poco is used.


Native application

For native applications (including system interface) on Android and iOS platforms, you can use Poco directly.

Preparation: Download Airtest IDE, unzip and run it.

Android native applications

  1. Prepare an Android phone, turn on the USB debugging function, and then connect the computer. Under normal circumstances, you can see the phone list in Airtest IDE:
  2. Click connect and you will see the device screen in Airtest IDE. Now enter the Android main interface, click the Poco auxiliary window on the left, select the Android mode, and you can see the UI tree structure of the current interface:
  3. Select the Poco Inspector button in the Poco auxiliary window to position the UI controls on the page: image
  4. Similar to the way Airtest is used, we can use the methods provided by Poco to operate the elements on the interface:
# Initialization statement automatically inserted by Airtest IDE

from import AndroidUiautomationPoco
poco = AndroidUiautomationPoco(use_airtest_input=True, screenshot_each_action=False)

# Click on the settings icon

As shown in the code above, you can locate elements and perform operations through UI properties.

For more details on using Poco to test Android native applications, you can refer to the tutorial (How to Automate Testing on Android Phones).

iOS native app

For iOS native applications, Poco can also get the UI hierarchy. In addition to downloading and running the Airtest IDE, we also need to run the ios-Tagent project to get the UI information of the iOS interface. Specific steps are as follows:

  1. Connect an iOS phone, start the ios-Tagent project, and run it on the phone in Test mode.
  2. Use the iproxy command to start the proxy
    bash iproxy 8100 8100 If you want to connect your iOS phone to another computer, you can install wdaproxy
  3. Start Airtest IDE and enter the proxy address to connect to iOS phone
  4. Select the iOS mode in the Poco auxiliary window, and you can see the UI tree structure of the current interface:
  5. After getting the UI level relationship of the interface, we can use the API provided by Poco to write automation scripts ~


Because the game interface is rendered by the game engine, and the game interface does not have the system's native control information. So for games, we need to access poco-sdk to get the control information in the game interface. The following uses the mobile game developed by Unity as an example to introduce how to connect on Android and iOS platforms.

Android games

  1. Refer to Engine Access Guide to access Poco-sdk. The following is the access method in Unity:
  2. Start the Airtest IDE and start the corresponding game. Select the Unity mode in the Poco auxiliary window to see the UI tree structure of the current interface:
  3. After selecting Unity mode, Airtest IDE will automatically insert poco's initialization code:
from poco.drivers.unity3d import UnityPoco
poco = UnityPoco()

After that, we can write scripts to use the API provided by Poco to operate the elements on the game interface.

iOS games

  1. Similarly, you need to connect to the engine SDK first, and then connect to the iOS phone through the Airtest IDE.
  2. Different from Android, the connection of iOS Unity Poco requires starting two proxy. 8100 port is used to connect iOS mobile phone, and 5001 port is used to connect to rpc port of poco-sdk. iproxy 8100 8100 iproxy 5001 5001 Iproxy here is equivalent to forward in adb.
  3. After connecting the iOS phone, select the Unity mode in the Poco auxiliary window, and you can see the UI tree structure of the current interface:
  4. Then you can write automated test scripts for games on iOS through the API provided by Poco.

Poco's platform support

Poco needs to be connected to Poco-SDK before it can be used normally on most platforms. However, on a few platforms (such as Android and iOS native apps), Poco can be used directly. The currently supported platforms are as follows:

Platform Airtest Poco
Cocos2dx-js, Cocos2dx-lua Access document
Unity3D Access document
Android native APP use directly
iOS Help documentation
Egret Access document
Other engines Access by yourself
WeChat Applet&webview Reference documents may become invalid with WeChat update
Windows, MacOS Stay tuned
Netease Engine help documentation for NetEase internal

In the document Poco Support Platform, you can get the latest updated platform support.

More details reference

Please check the Poco official documentation for more tutorials and API information, here are some of the more concerned content: