Airtest

Latest version: v1.3.4

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

Scan your dependencies

Page 3 of 5

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

1.1.9

新增功能或优化项

- 重新恢复iOS的端口转发功能,能够对本机USB线连接的iOS上的端口进行转发,也就是说,目前恢复了iOS上面的Unity-Poco的支持
- 请mac用户在使用本功能时,最好安装`iproxy`,在终端中运行:`brew install usbmuxd`
- 新手机初始化的时候,去掉了`RotationWatcher.apk`的安装,减少一个安装程序
- 优化了图像识别算法在使用`rgb=True`参数时的效果,现在能够更好地识别出不同颜色图片了

BUG修复:

- log的时间改为24小时制
- 修复了ios swipe接口遗漏了一个参数的BUG
- 修复了`adb.file_size`不能正确获取到文件大小的bug
- 在大于python3.7的环境中,由于opencv图像算法的版权问题,导致有部分算法不能使用,因此把默认使用的算法都改为可用的算法,删除了报错日志

* * *

New features or optimization items

- Restore the iOS port forwarding function, which can forward the port on iOS connected with the USB cable of the machine, that is to say, the support of Unity-Poco on iOS has been restored.
- When using this function for mac users, it is best to install `iproxy` and run in the terminal: `brew install usbmuxd`
- When the new phone is initialized, the installation of `RotationWatcher.apk` is removed, reducing one installation procedure
- Optimized the effect of the image recognition algorithm when using the `rgb=True` parameter, and now it can better recognize pictures with different colors

BUG fix:

- The log time is changed to a 24-hour system
- Fixed a bug where a parameter was missing from the ios swipe interface
- Fixed the bug that `adb.file_size` could not get the file size correctly
- In an environment greater than python3.7, due to the copyright issue of the opencv image algorithm, some of the algorithms cannot be used, so all the algorithms used by default are changed to available algorithms, and the error log is deleted

Page 3 of 5

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.