This document is only a supplementary document for the Poco framework and the AirtestIDE editor. Be sure to visit Poco Project Documentation for complete information about the document.
6.1 Getting started with Poco¶
Poco is an automation framework based on UI control search. Unlike Airtest, which is based on image recognition, Poco can use a method similar to
poco("OK"). Click() to obtain and operate nodes.
Currently supported platforms¶
On most platforms, Poco needs to be connected to Poco-SDK before it can be used normally, Poco can be used directly on a few platforms (such as Android native APP), and it currently supports the following platforms:
|Cocos2dx-js, Cocos2dx-lua||√||Access document|
|Native Android APP||√||Use directly|
|Other engines||√||Can access by yourself|
|WeChat Applet&webview||√||Reference documents May become invalid with WeChat update|
|Windows, MacOS||√||stay tuned for more|
More platform support is being added one after another. If there is a need for platform support, you can submit an issue on Poco-github, or contact us.
Teaching use cases¶
Please be sure to check the Poco project documentation-Getting Started Use Cases to learn the method of control selection and operation.
If you use a local Python environment and want to develop Poco scripts like normal Python, please refer to the related chapter in Poco Quick Start . Add
import poco in the
.py file and you can use Poco related functions. So the script can be developed in any text editor or common Python editor, and you can use the lightweight viewer PocoHierarchyViewer to get the properties of the control.
However, we have provided simpler Poco control acquisition and scripting functions in AirtestIDE. Follow these steps to get started quickly:
- Refer to the list of supported platforms above to access Poco-SDK in your game or application
- When switching the Poco application type, a notification window will pop up in the script edit box, prompting to insert the code to initialize Poco. Click Yes to insert a corresponding type of Poco initialization code in the current script.
- Start writing Poco scripts
The general steps are shown in the figure:
Poco auxiliary window in AirtestIDE¶
In AirtestIDE, there are many functions that are convenient for Poco script writing. For example, after clicking the record button on the Poco auxiliary window, you can automatically generate the corresponding Poco statement according to the current operation:
However, the automatically generated statements may not work well. Generally, we need to write more complex statements and more precise UI control selection statements. In AirtestIDE, we can use the pause function to freeze the current UI tree structure to accurately view the UI controls. Double-clicking the nodes on the UI tree can automatically insert Poco statements. More precise adjustments to them can further improve the usability of our script readability and success rate:
For specific usage tutorial, please refer to Recording Script-3.3 Poco Auxiliary Function.
In view of the tedious steps of accessing the SDK, we have provided several simple demos on different platforms for everyone to download and experience Poco. Please go to Poco Examples and Tutorials page for more details.
Why did I fail to flush the UI tree after I chose Poco mode?¶
Here you can view the list of currently supported platforms. Except for Android native apps, which can be used directly without having to access the SDK, the rest of the engines need to access the SDK in order to obtain UI structure information (The game cannot directly see the UI tree without accessing the SDK in advance.). please be sure to read the Access Document carefully and use it after accessing the SDK.
Why can't I see the UI tree after accessing the SDK and using native apps?¶
When Poco is initialized, the relevant apk will be installed in the phone. Please ensure that the phone allows the installation of the relevant apk. Some models of mobile phones need to enable the corresponding options in the settings for installation, such as "Allow apps to be installed through ADB".
Some manufacturers' phones require additional settings. For example, you need to manually set the Yosemite input method as the default in the input method options. For details, refer to Special Issues with Some Manufacturers' Devices.
UI tree doesn't refresh properly after some time¶
You can try to change the drop-down menu of the Poco mode option to
Stop, and then reselect the mode you need, such as
Android, and the IDE will re-establish the Poco communication connection with the mobile phone.
Sometimes it is also possible that the mobile phone automatically shuts down the pocoservice process in the background due to insufficient mobile phone memory, which eventually leads to disconnection. In this case, it is recommended to try another mobile phone with better configuration and try again.
Visit our Github page AirtestProject to see our open source Poco, Poco-SDK, and the PocoUnit project that you can choose to use.
If you have more questions, please submit issues to help us improve the project.