Airtest

Latest version: v1.3.5

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

Scan your dependencies

Page 1 of 5

1.3.5

1.3.4

ADD:
- 增加了`minicap`对于`Android 14`版本的支持
---
ADD:
- Added `minicap` support for `Android 14` version.

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 some new clipboard-related interfaces
- `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))

Page 1 of 5

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.