AirTest & Appium Mac2Driver

It is a cross-platform UI automated testing framework based on image identification. And it is suitable for games and apps, and the supported platforms are Windows, Android and iOS.

In previous articles we have introduced the Airtest library and appium mac2 driver in detail. Assuming you have gone through all the setup instruction.  Now we’ll be able to put them all together to achieve automation MacOS apps using OCR.

Integrate with Appium Mac2Driver

Start appium and connect to server:

Copy to Clipboard

Get scale of resolution and set size for image recognition:

Copy to Clipboard

Overwrite findelement function to support image recognition and return ImageElement:

Copy to Clipboard

Finnally achieve the operations under ImageElement class:

Copy to Clipboard

After framework encapsulation, write the test script:

Copy to Clipboard