Python命令汇总:雷电模拟器
写在前面
使用目的:雷电模拟器库函数调用(调用时注意函数前缀
)
一、模拟器参数操作
- 添加模拟器
add(name: str)
- 获取安装包列表
get_package_list(index: int) -> list
- 检测是否安装指定的应用
has_install(index: int, package: str)
- 获取模拟器列表
results = Dnconsole.get_list()
- 获取正在运行的模拟器列表
results = Dnconsole.list_running()
- 检测指定序号的模拟器是否正在运行
results = Dnconsole.is_running(0)
- 安装、下载、启动、停止 应用程序
install(index: int, path: str)
uninstall(index: int, package: str)
invokeapp(index: int, package: str)
stopapp(index: int, package: str)
- 设置自动旋转
auto_rate(index: int, auto_rate: bool = False)
二、模拟器应用操作
- 启动模拟器
launch(index: int)
- 关闭模拟器
quit(index: int)
- 获取当前activity名称
get_activity_name(index: int)
- 等待某个activity出现
wait_activity(index: int, activity: str, timeout: int) -> bool
- 输入文字
input_text(index: int, text: str)
- 找图
find_pic(screen: str, template: str, threshold: float)
- 等待某个图片出现
wait_picture(index: int, timeout: int, template: str) -> bool
三、模拟器模拟操作
- 点击或者长按某点
touch(index: int, x: int, y: int, delay: int = 0)
- 滑动
swipe(index, coordinate_leftup: tuple, coordinate_rightdown: tuple, delay: int = 0)