Airtest

Latest version: v1.3.5

Safety actively analyzes 701287 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 5

1.2.5

Add new

- iOS screen projection speed optimization, new MJPEG mode, viewing iOS screen images at a higher speed
- iOS click speed optimization, please update [iOS-Tagent](https://github.com/AirtestProject/iOS-Tagent) to the latest version (if you originally used the Appium/WebDriverAgent project, you can replace it with our version) , after the update can greatly reduce the click delay
- **Please use the latest version of AirtestIDE 1.2.14**, you can experience the best effect, otherwise it may cause the problem of wrong click position
- **If you use Poco, please update to version 1.0.87**, otherwise it may cause the problem of wrong click position

Related Notes:

1. On a very small number of devices, the click position may be offset. At present, the offset of the mouse click cannot be corrected on AirtestIDE, but it can be fixed in the code, for example:

We tested an iPhone 7Plus mobile phone, and there is a coordinate offset phenomenon when clicking, so it can be corrected when running the code in the following way:



>>> device = connect_device("iOS:///")
>>> device.touch((100, 100)) wrong position
>>> print(device.touch_factor)
0.333333
>>> device.touch_factor = 1 / 3.3 default is 1/3
>>> device.touch((100, 100))


Explanation about `touch_factor`:

> `touch_factor` This value is used to convert the touch coordinates of iOS devices:
>
> Phone real coordinates = touch_factor * screen coordinates
> The default calculation is: `self.display_info['window_height'] / self.display_info['height']`
> But it may be inaccurate on some special models of mobile phones, such as 7P of iOS14.4, the default value is 1/3, but the click position of some 7P is inaccurate, you can set it yourself: self.touch_factor = 1 / 3.3

Poco related notes:

1. Due to the high latency of Poco on iOS, it may also cause lag when it is turned on.
2. Some ipads may be in landscape + desktop, and the Poco obtained is in the wrong position. It is not recommended to click an icon on the desktop to open the app, try to use `start_app` to open it, but this interface must be transferred to the mobile phone. For some app package names, if the incoming package name does not exist, an error may be reported

BUG fixes

1. Fixed a bug that system resources were not completely released when Android screen recording, which may lead to memory overflow
2. Slightly optimized the recognition effect of `mstpl`
3. Fixed the possible click failure problem on mobile phones with Android 10 and above
4. Removed the restriction on numpy version number during installation
5. Compatible with jinja2>3.1 version
6. Fix the problem that the `adb.file_size` interface fails to obtain the file size under the Android 6.0.1 system

1.2.4

Fix:
- 安卓在录屏强制中止的情况下,下一次启动录屏时优先清理之前的录屏再开始新录屏,避免启动录屏失败
- 部分手机如oppo/vivo等,在没有安装/启用yosemite输入法时无法使用,改用`adb shell input text`输入(不支持中文)
- `wake`接口先尝试使用`keyevent224`和`82`解锁android屏幕,如果解锁失败,再尝试用yosemite解锁
- 图像识别:计算置信度过程加入极限值噪点,修复纯色状态时置信度异常高的问题。RGB模式对极限值进行裁剪,修复色相角度计算异常的问题。

Add:
- 新增Android 12的minicap截图支持

* * *
Fix:
- When Android screen recording is forcibly suspended, the next time you start screen recording, it will prioritize cleaning up the previous recording screen before starting a new screen recording to avoid starting screen recording failure
- Some mobile phones such as oppo/vivo cannot be used without yosemite input method installed/enabled. Use `adb shell input text` instead (Chinese is not supported)
- `wake` interface first try to use `keyevent224` and `82` to unlock the android screen, if the unlocking fails, try to unlock it with yosemite
- Image recognition: Add limit value noise to the process of calculating the confidence level to fix the problem of abnormally high confidence in the pure color state. RGB mode cuts the limit value and fixes the problem of abnormal hue angle calculation.

Add:
- Added `Android 12` minicap screenshot support

1.2.3

主要改动:
- 修改了获取Android设备屏幕尺寸的方式,尽量兼容了手机、平板、特殊车机设备

1.2.2

1.2.0

<span id="english"> </span>

New: image recognition algorithm mstpl

We have added an improved version of the template matching recognition algorithm, which can greatly increase the success rate of the original template matching and better adapt to scenes with changing resolutions.

Update Airtest to version 1.2.0 or higher. If you are using AirtestIDE, please also update to version 1.2.10 or higher. The latest version has set this algorithm as the preferred algorithm.

Please refer to the following code example:

python
from airtest.core.api import *

touch(Template("search.png", scale_max=800, scale_step=0.005))


When the Template image object is initialized, the parameters related to image recognition are as follows:

- `threshold`: used to set the screening threshold of image recognition, the default is 0.8, so the recognition effect is required to be greater than 0.8 before the recognition is considered successful
- `rgb`: Whether to perform color recognition, the default is False, which means that airtest will process the picture as a grayscale picture by default, so if you need to add color three-channel recognition, you need to set it to True
- Newly added `scale_max`: new algorithm special parameter, used to adjust the maximum range of matching, **If the target UI to be searched is small, you can increase this value** appropriately, the default value is 800, the recommended value is 740, 800 , 1000 Value range [700, 2000]
- Newly added `scale_step`: a new algorithm dedicated parameter, used to control the search scale step size, **If the target UI to be found is small, you can appropriately reduce this value**, the default value is 0.005, the recommended value is 0.02, 0.005 , 0.001 Value range [0.001, 0.1]

If you encounter problems or abnormal errors during image recognition, please take a screenshot of the current interface and submit an issue together with the pictures used in the script.

Interface changes: No need to set parameters when connecting to a mobile phone

In Airtest 1.2.0 and above, we no longer want everyone to manually specify the connection parameters when connecting to the phone, including `cap_method`, `touch_method`, and `ori_method`.

Therefore, we have made some changes. When initializing the phone, if there is a problem, Airtest will automatically try to be compatible and select a backup plan to connect until it succeeds.

The important changes that need attention are as follows:

- **Currently Android12 is not yet well supported**, the screen effect is very poor
- Added `Android.screen_proxy`, which is similar to the previous touch_proxy and uses it as the call entry of the screenshot method.
- When initializing the Android() object, you can **no longer force to specify `cap_method="MINICAP"` or `"JAVACAP"`**, `screen_proxy` will automatically initialize in order until the screenshot method that can be successfully initialized is selected .
- For example, when connecting to the simulator before, you need to check `use javacap` on the IDE, or specify `cap_method=JAVACAP` when the script is running. Now it is not necessary to specify it, and it can be initialized successfully.
- Deleted the parameter `cap_method=MINICAP_STREAM`, please **do not pass the value of `MINICAP_STREAM` again**
- The priority order of initialization is `custom screenshot method` > `MINICAP` > `JAVACAP` > `ADBCAP`. If ADBCAP is called, a warning will be printed to tell the user that the screenshot efficiency is very low at this time.
- Keep some of the old call entry points, which is convenient to be compatible with the old code
- For example, `dev.minicap` will return the `dev.screen_proxy` object, and the `dev.minicap.get_frame_from_stream()` interface can still be used
- For example, `dev.cap_method` will return the name of the currently used screenshot method (such as `"MINICAP"`), and you can also use `dev.cap_method = "JAVACAP"` to force the specified screenshot method
- When acquiring pictures, there is no need to perform a lot of type judgment and then call the corresponding screenshot method
- Use `dev.screen_proxy.get_frame_from_stream()` directly
- That is, the previous code can be discarded:
-
if dev.cap_method == CAP_METHOD.MINICAP:
dev.minicap.get_frame_from_stream()
elif dev.cap_method == xxx:
...

- If you want to implement a new custom screenshot method: In `airtest.core.android.cap_methods.base_cap`, the base class `BaseCap`, which implements all screenshot methods, can be inherited and implement the interface `get_frame_from_stream`. A custom screenshot method can be added, and it can be used by registering it in ScreenProxy
- python
from airtest.core.android.cap_methods.base_cap import BaseCap
class TestCap(BaseCap):
def get_frame_from_stream(self):
return b"frame"

ScreenProxy.register_method("TESTCPY", TestCap)
The default priority is initialized to the custom TestCap
cap = ScreenProxy.auto_setup(dev.adb)


Other bug fixes

- `nbsp` added an `auto_kill` parameter, which can automatically kill the socket when the phone is disconnected to avoid memory leaks
- Solved several warnings that did not completely close the io stream at the end
- Compatible with / at the end of the script path passed in when the script is running
- The `SIFT` algorithm patent has been lifted, so the SIFT algorithm has been re-added as the default algorithm, but it is limited by the version number of OpenCV. Not all version numbers can be used directly https://github.com/AirtestProject/Airtest/commit/c8e9bba038b3bb1b5201bb336b5f99a1f5f7c71a
- Fixed an issue where the display_info size obtained in landscape mode was reversed on some new models of mobile phones. This issue would cause the screen to display incorrectly in landscape mode on the IDE https://github.com/AirtestProject/Airtest/pull/913/commits/9bcccdf06485b0121df2adf504f95693e9af3825
- Many models have been tested to fix this problem (such as vivo iQOO Neo5, Huawei Mate40Pro, etc.)
- If there are still models with the wrong display when the screen is rotated horizontally and vertically, please tell us the specific model

1.1.11

- pypi打包版本补充了缺失的ios资源文件
- py2不再要求安装`facebook-wda`库,避免了安装过程中可能因为第三方库依赖py3而报错(airtest的ios模块,在py2下无法使用)
- 修复了在极少数情况下可能会获取不到手机渲染分辨率,导致获取的手机尺寸为0的问题
- `rotationwatcher.jar`缩减包体大小到7kb
- 恢复了iOS手机端口转发功能,可以使用iOS上面的unity-poco了(linux下如果是ubuntu,可以运行apt-get install libusbmuxd-tools)
- 增加了一个自动chmod +x的操作,能自动为adb和iproxy文件增加可执行权限
- 修正了一些wda兼容性的问题

- The pypi packaged version supplements the missing ios resource files
- py2 no longer requires the installation of the `facebook-wda` library, which avoids errors that may be reported during the installation process due to third-party libraries relying on py3 (airtest's ios module cannot be used under py2)
- Fixed the issue that in rare cases the rendering resolution of the phone may not be obtained, resulting in the size of the obtained phone being 0
- `rotationwatcher.jar` reduces the package size to 7kb
- The port forwarding function of iOS mobile phones has been restored, and unity-poco on iOS can be used (if it is ubuntu under linux, you can run apt-get install libusbmuxd-tools)
- Added an automatic chmod +x operation, which can automatically increase executable permissions for adb and iproxy files
- Fixed some wda compatibility issues

Page 3 of 5

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.