This document is only a supplement of Poco framework and AirtestIDE editor, please visit Poco Project Document for more information.
Poco quick start¶
Poco is cross-engine UI automation framework that provides engine independent powerful APIs to retrieve the UI element hierarchy. Poco supports mainstream game engines such as Unity3D, Cocos2dx, native Android apps etc.
Unlike Airtest, which is based on image recognition, Poco can use code like
poco("OK").click() to get and control elements of the UI hierarchy.
On most platforms, Poco needs to be implemented to Poco-SDK first , or it won’t function properly. But on a few platforms (like native Android APP), Poco can be used directly. Currently, the supported platforms are:
|Cocos2dx-js, Cocos2dx-lua||Implementation Document|
|Native Android APP||Use directly|
|WeChat Applet||Reference document may be invalidated along with WeChat’s update|
|webview||Please refer to issue|
|Windows, MacOS||Coming soon|
We are working on the support of more platforms. To request support of other platforms, please submit an issue via Poco-github or contact us.
Tutorials and Examples¶
Please be sure to check the Poco project document - Tutorials and examples to learn the basic methods of selecting control elements and how to operate on them.
If you use local Python environment and want to develop Poco scripts just like regular Python, please refer to the related chapters in Poco Quick Start document. Import poco in
.py files to start using Poco. Poco scripts can be developed by any text editor or Python editor. Use PocoHierarchyViewer to get the attributes to control the elements.
However, in AirtestIDE there are simpler functions for getting Poco control elements and scripting. Follow these steps to get started quickly:
- Refer to the supported platforms above and implement your game/app with Poco-SDK.
- When you switch Poco application type, a notice box to insert code to initialize Poco will pop up in script edit box. Click ‘Yes’ to insert the related Poco initialization code in the current script.
- Start writing Poco scripts.
Steps as shown below:
Poco assistance window in AirtestIDE¶
In AirtestIDE, there are many functions that are convenient for writing Poco scripts. For example, after clicking the record button in Poco assistance window, Poco statements will be automatically generated according to current operation:
But the auto-generated statements may not be satisfying. Usually, we need to write some more complicate statements as well as statements that select the UI control elements more precisely. In AirtestIDE, with the pause function, we can freeze the current UI tree structure to inspect the UI control elements precisely. Double clicking the nodes on the UI tree automatically inserts Poco statements, which can be adjusted more precisely to further improve the readability and running success rate of the scripts:
For a detailed use tutorial, please refer to Performing automation testing with Poco
Considering the steps for implementing the SDK are quite complicated, we offer several simple Demo examples on different platforms for you to download and familiarize with Poco. Please visit Poco Examples and Tutorials for more details.