Poco drivers (engine specific poco implementation)¶
For different engines please initialize
poco instance by corresponding driver. Here are API reference of different
Following example shows how to initialize poco instance for Unity3D. Remember to connect an Android device to your PC/mac with a running game or launch and keep the Unity game active on PC/mac.
# import unity poco driver from this path from poco.drivers.unity3d import UnityPoco # then initialize the poco instance in the following way poco = UnityPoco() # for windows # poco = UnityPoco(('localhost', 5001), unity_editor=True) # now you can play with poco ui = poco('...') ui.click()
For cocos2dx-lua games are similar as Unity3d drivers.
# import standard poco driver from poco.drivers.std import StdPoco from airtest.core.api import connect_device # connect a device first, then initialize poco object device = connect_device('Android:///') poco = StdPoco(10054, device) # now you can play with poco ui = poco('...') ui.click()
If multiple devices connected, please select one by invoking
connect_device from airtest API.
from poco.drivers.unity3d import UnityPoco from airtest.core.api import connect_device connect_device('Android:///014E05DE0F02000E') # connect device by serialno poco = UnityPoco()
For other engines, refer to Integration guide for more details
Device is an abstract object which game/app runs on. In poco communicating with game/app is under a connection with
the device. This device connection is handled by Airtest device abstraction (take Android as example).
There are 2 ways to connect to the device.