Airtest

Latest version: v1.3.3

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

Scan your dependencies

Page 1 of 5

1.3.3

ADD:

- `touch`, `swipe`接口新增相对坐标的支持
- 例如点击中心点 touch((0.5, 0.5))
- 从右往左滑动 swipe((0.7, 0.5), (0.2, 0.5))
- 目前android/ios/win都支持
- windows新增了剪贴板相关的接口
- `get_clipboard` 获取剪贴板内容,`set_clipboard` 设置剪贴板内容, `paste` 粘贴
- 因此如果有大段文字需要输入,原本使用text接口将会一个一个输入,效率很低,现在可以使用`set_clipboard` 设置到剪贴板之后,再使用`paste`粘贴即可
- 剪贴板三个接口目前win/ios/android都支持了
- Android支持手动指定`touch_method`,来强制指定`ADBTOUCH`, 或 `MINITOUCH`, `MAXTOUCH`
- `dev.touch_method = "ADBTOUCH"`

FIX:

- Yosemite.apk更新,新增了判断输入法是否完全启动的接口,避免输入失败
- 修复了某些低版本iOS设备使用swipe接口会报错的问题(报错信息为:`Invalid parameter not satisfying: allAttributesForKey != nil`)
- 修复了1.3.2版本引入的adb路径为None的bug
- 修复了部分安卓设备屏幕只显示一半,并且无法恢复的问题

* * *

ADD:

- `touch`, `swipe` interfaces add support for relative coordinates
- For example, click the center point touch((0.5, 0.5))
- Swipe from right to left swipe((0.7, 0.5), (0.2, 0.5))
- Currently supported by android/ios/win
- Windows has added a new clipboard-related interface
- `get_clipboard` gets the clipboard content, `set_clipboard` sets the clipboard content, `paste` pastes
- Therefore, if there is a large section of text that needs to be entered, the original text interface will be entered one by one, which is very inefficient. Now you can use `set_clipboard` to set it to the clipboard, and then use `paste` to paste it.
- The three clipboard interfaces are currently supported by win/ios/android.
- Android supports manually specifying `touch_method` to force specifying `ADBTOUCH`, or `MINITOUCH`, `MAXTOUCH`
- `dev.touch_method = "ADBTOUCH"`

FIX:

- Yosemite.apk has been updated, adding an interface to determine whether the input method is fully started to avoid input failures.
- Fixed an issue where some lower version iOS devices would report an error when using the swipe interface (the error message is: `Invalid parameter not satisfying: allAttributesForKey != nil`)
- Fixed the bug that the adb path introduced in version 1.3.2 is None
- Fixed the issue where the screen of some Android devices is only half displayed and cannot be restored

1.3.2

1. 【重要】ADB升级至41版本,与之前的ADB版本不兼容,请注意保证系统环境中所有的ADB版本一致,否则可能会导致无法连接设备
2. iOS模块新增一个Error类型,`LocalDeviceError`,部分接口只有本地USB连接的iOS设备才可以用,远程设备将会抛出这个异常。因此若有需要,可以catch住这个异常,并对远程设备做一些额外的兼容和处理。
3. 更新了yosemite.apk,对一些设备的兼容性更好
4. 修复了一些其他问题

* * *

1. [Important] ADB has been upgraded to version 41, which is incompatible with previous ADB versions. Please ensure that all ADB versions in the system environment are consistent, otherwise the device may not be connected.
2. The iOS module adds a new Error type, `LocalDeviceError`. Some interfaces can only be used by local USB-connected iOS devices, and the remote device will throw this exception. Therefore, if necessary, you can catch this exception and do some additional compatibility and processing for the remote device.
3. Updated yosemite.apk to have better compatibility with some devices
4. Fixed some other issues

1.3.1

1. 报告中现在将会显示connect_device接口连接的设备
2. ios和android设备在连接时,支持传入name参数,用于指定它的udid(ios)或serial number(android)
例如: `ios:///http://10.240.145.171:20092?name=83282c400efc9122e3bcba60c803cf318a6b3822`
安卓远程设备: `android://127.0.0.1:5037/10.227.71.86:20029?name=serialno`
3. adb现在将会优先使用当前的adb进程,或者是系统变量设置了ANDROID_HOME中的adb,如果都找不到,才会使用airtest里的adb。
同时也支持直接指定`adb_path`,例如:

from airtest.core.android.android import Android, ADB

adb = ADB(adb_path=r"D:\adb\adb.exe")

或者可以初始化一个指定了adb_path的Android设备对象
dev = Android(serialno="5TSSMVBYUSEQNRY5", adb_path=r"D:\test\adb41\adb.exe")


5. 剪贴板的相关接口增加了安卓的支持,增加了粘贴接口(`paste`,效果等同于执行 `text(get_clipboard())`)


text = "test_clipboard"
set_clipboard(text)

get_text = get_clipboard()
print(get_text) -> test_clipboard

paste() => text(get_clipboard())


bug修复:
修复了一些小问题
如果遇到了手机画面只有一半的情况,重新连接画面即可恢复。

* * *

1. The report will now display the devices connected to the connect_device interface.
2. When connecting ios and android devices, the name parameter can be passed in to specify its udid (ios) or serial number (android)
For example: `ios:///http://10.240.145.171:20092?name=83282c400efc9122e3bcba60c803cf318a6b3822`
Android remote device: `android://127.0.0.1:5037/10.227.71.86:20029?name=serialno`
3. adb will now give priority to using the current adb process, or the system variable is set to adb in ANDROID_HOME. If neither is found, adb in airtest will be used.
It also supports directly specifying `adb_path`, for example:

from airtest.core.android.android import Android, ADB

adb = ADB(adb_path=r"D:\adb\adb.exe")

Or specify adb_path when initializing the Android object
dev = Android(serialno="5TSSMVBYUSEQNRY5", adb_path=r"D:\test\adb41\adb.exe")

5. The relevant interfaces of the clipboard have been added with Android support and a paste interface (`paste`, the effect is equivalent to executing `text(get_clipboard())`)


text = "test_clipboard"
set_clipboard(text)

get_text = get_clipboard()
print(get_text) -> test_clipboard

paste() => text(get_clipboard())


bug fixes:
Fixed some minor issues
If you encounter a situation where the screen on your phone is only half full, you can restore the screen by reconnecting.

1.3.0

重要改动

**从airtest v1.3.0起,放弃对python2的支持**

新增

ios设备接口新增

iOS设备对象`IOS`,新增以下接口的支持:

1. (仅支持本地USB设备)安装 `install`


install(r"D:\demo\test.ipa") install iOS ipa
install("http://www.example.com/test.ipa") # install iOS ipa from url



获取当前设备
dev = device()

通过本地.ipa文件安装APP
dev.install_app(r"D:\demo\test.ipa") install iOS ipa

通过下载链接安装APP
dev.install_app("http://www.example.com/test.ipa") # install iOS ipa from url


2. (仅支持本地USB设备)卸载 `uninstall`


uninstall("com.netease.cloudmusic")



dev = device()

dev.uninstall_app("com.netease.godlike")


3. (仅支持本地USB设备)列出所有的app,`list_app`

list_app("user") 传入要列出的app类型,可以得到app列表
参数可选`user/system/all` 分别表示列出用户安装的app/系统app/全部app
返回值示例:`[('com.apple.mobilesafari', 'Safari', '8.0'), ...]`


dev = device()

列出全部APP
all_app = dev.list_app("all")
print(all_app)

打印系统APP
print(dev.list_app("system"))

列出用户安装的APP
user_app = dev.list_app("user")
print(user_app)


4. 获取剪贴板内容, `get_clipboard`


text = get_clipboard()
print(text)


注意:**当iOS设备为远程设备、或者安装了不止一个wda时**,需要指定具体的`wda_bundle_id`才能使用:


text = get_clipboard(wda_bundle_id="com.WebDriverAgentRunner.xctrunner")


5. 设置剪贴板内容,`set_clipboard`

注意:**当iOS设备为远程设备、或者安装了不止一个wda时**,需要指定具体的`wda_bundle_id`才能使用


set_clipboard("content") local iOS

When the iOS device is a remote device, or more than one wda is installed on the device, you need to specify the wda_bundle_id
set_clipboard("content", wda_bundle_id="com.WebDriverAgentRunner.xctrunner")


iOS新增tidevice相关接口

针对本地USB接入的设备,airtest结合`tidevice`的能力,封装了一个`TIDevice`对象,提供了几个常用接口如下:

- `devices`:列出USB连接的所有设备的 UDID 列表
- `list_app`: 列出手机上安装的应用列表,支持对类型进行筛选,包括 user/system/all
- `list_wda`: 列出手机上安装的所有WDA的bundleID
- `device_info`:获取手机信息
- `install_app`:安装ipa包,支持本地路径或URL
- `uninstall_app`:卸载bundle_id对应的包体
- `start_app`:启动 bundle_id 对应的包体
- `stop_app`:停止 bundle_id 对应的包体
- `ps`: 获取当前的进程列表
- `ps_wda`: 获取当前启动中的WDA列表
- `xctest`:启动wda

可以参考:https://github.com/AirtestProject/Airtest/blob/master/tests/test_tidevice.py

代码执行效果示例:


>>> from airtest.core.ios.ios import TIDevice
>>> devices = TIDevice.devices()
>>> print(devices)
['10da21b9091f799891557004e4105ebab3416cb9']
>>> udid = devices[0]

>>> print(TIDevice.list_app(udid))

1.2.11.2.2

本次更新以bug修复、图像识别效果提升为主,更新内容如下:

- 修复上个版本改动带来的问题
- 修复在使用py2、或者是某些特殊版本的python时,导致的一些报错
- 初始化minitouch时,不再额外增加一个(0, 0)坐标的点击,避免误点
- 图像识别算法的改进
- 优化了`mstpl`算法,提升了判定的严格程度,可以有效降低当目标图片不在当前画面中的误检率
- `tpl`算法被添加回设置里,可以在mstpl失败时作为补充方案
- 修复了mstpl算法在参数错误时的容错
- 在`adb.pm_install`接口中增加安装完毕后自动删除apk包的功能,避免调用完之后没清理,残留大量apk包的问题
- 其他BUG修复
- 当断开连接时,有可能会有部分forward过的端口没有被完整回收 https://github.com/AirtestProject/Airtest/commit/620d17c0ffca5fc837f214f407a22779be1e0517
- 部分特殊型号的手机,在上个版本更新后,仍然可能出现连接后只能看到半屏图像的问题(VIVO X30 Pro),因此在获取设备宽高数据时,强制指定更短的边为width,更长的边为height
- merge了 https://github.com/AirtestProject/Airtest/pull/939 , 更好地兼容了windows双屏的情况
- 其他一些小BUG的修复

* * *

This update focuses on bug fixes and improved image recognition effects. The update content is as follows:

- Fix the problems caused by the changes of the previous version
- Fix some errors caused when using py2 or some special versions of python
- When initializing the minitouch, no additional clicks with (0, 0) coordinates are added to avoid mistakes
- Improvement of image recognition algorithm
- Optimized the `mstpl` algorithm to improve the strictness of the judgment, which can effectively reduce the false detection rate when the target picture is not in the current picture
- The `tpl` algorithm is added back to the settings, which can be used as a supplementary solution when mstpl fails
- Fixed the fault tolerance of mstpl algorithm when the parameters are wrong
- Add the function of automatically deleting the apk package after the installation is completed in the `adb.pm_install` interface to avoid the problem of a large number of apk packages that are not cleaned up after the call is completed
- Other bug fixes
- When the connection is disconnected, some of the forwarded ports may not be fully recovered https://github.com/AirtestProject/Airtest/commit/620d17c0ffca5fc837f214f407a22779be1e0517
- For some special models of mobile phones, after the last version update, there may still be a problem that only half-screen images can be seen after connecting (VIVO X30 Pro). Therefore, when obtaining the device width and height data, it is mandatory to specify the shorter side as width, the longer side is height
- Merged https://github.com/AirtestProject/Airtest/pull/939, which is better compatible with dual-screen windows
- Some other minor bug fixes

1.2.10.2

- The `cv2` mode provided in 1.2.9 has been abandoned, because it is prone to errors and the effect is not as good as ffmpeg
- The start_recording of win/ios does not need to have the mode parameter, only android needs the mode parameter
- The ffmpeg mode of screen recording adds the max_size parameter, which can specify the image size of the screen recording result, because the larger the screen image, the greater the system load caused by the screen recording (CPU and memory usage)

Code example:

dev = connect_device("android:///")
dev.start_recording(output="test.mp4", mode="ffmpeg", max_size=800) Android supports mode to specify the use of ffmpeg mode


Other changes
- If the Android screen is half black, you can reconnect again
- Removed numpy version number restriction

Page 1 of 5

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.