当前位置: 首页 > news >正文

红色政府网站模板北京搜索引擎推广服务

红色政府网站模板,北京搜索引擎推广服务,域名网站大全,电子商务网站建设评价1. 前言 本次更新为Airtest库更新,版本提升至1.3.0.1版本,主要新增了一些iOS设备相关的装包等接口,以及封装了一些tidevice常用接口。更多更新详情,详见我们下文的描述。 2. 新增iOS设备接口 1)iOS安装接口&#xf…

1. 前言

本次更新为Airtest库更新,版本提升至1.3.0.1版本,主要新增了一些iOS设备相关的装包等接口,以及封装了一些tidevice常用接口。更多更新详情,详见我们下文的描述。

2. 新增iOS设备接口

1)iOS安装接口:installinstall_app

对于 本地USB连接的iOS设备 ,新版本支持装包功能:

# 可以直接使用install接口,支持通过本地.ipa文件安装APP,也支持通过下载链接安装APP
install(r"D:\demo\test.ipa") 
install("http://www.example.com/test.ipa") # 也可以先获取当前设备,用device().install_app的方式装包
dev = device()dev.install_app(r"D:\demo\test.ipa")
dev.install_app("http://www.example.com/test.ipa") 

2)iOS卸载接口:uninstalluninstall_app

对于 本地USB连接的iOS设备 ,新版本支持卸载功能:

# 可以直接使用uninstall接口卸载包体
uninstall("com.netease.cloudmusic")# 也可以先获取当前设备,用device().uninstall_app的方式卸载包体
dev = device()dev.uninstall_app("com.netease.godlike")

3)列出iOS设备所有APP的接口:list_app

对于 本地USB连接的iOS设备 ,新版本支持列出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)iOS剪切板功能:get_clipboardset_clipboard

对于iOS设备(本地、远程均可),新版本支持剪切板功能:

#获取剪切板内容
text = get_clipboard()
print(text)#设置剪贴板内容
set_clipboard("content")

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

#获取剪切板内容
text = get_clipboard(wda_bundle_id="com.WebDriverAgentRunner.xctrunner")#设置剪贴板内容
set_clipboard("content", wda_bundle_id="com.WebDriverAgentRunner.xctrunner")

3. 新增tidevice相关接口

针对本地USB接入的iOS设备,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))
[ ('com.230316modified.WebDriverAgentRunner.xctrunner', 'wda-Runner', '1.0'),]>>> print(TIDevice.list_app(udid, "system"))
[('com.apple.calculator', 'Calculator', '1.0.0'),]>>> print(TIDevice.list_wda(udid))
['com.test.WebDriverAgentRunner.xctrunner']>>> print(TIDevice.device_info(udid))
{'productVersion': '12.4.8', 'productType': 'iPhone7,2', 'modelNumber': 'MG472', 'serialNumber': 'DNPNW6EJG5MN', 'timeZone': 'Asia/Shanghai', 'uniqueDeviceID': '10da21b9091f799891557004e4105ebab3416cb9', 'marketName': 'iPhone 6'}>>> TIDevice.start_app(udid, "com.apple.mobilesafari")>>> TIDevice.stop_app(udid, "com.apple.mobilesafari")>>> print(TIDevice.ps(udid))
[ {'pid': 215, 'name': 'MobileMail', 'bundle_id': 'com.apple.mobilemail', 'display_name': 'MobileMail'}]>>> print(TIDevice.ps_wda(udid))
['com.test.WebDriverAgentRunner.xctrunner']

另外,TIDevice.xctest 接口的执行示例如下:

import threading
wda_bundle_id = TIDevice.list_wda(udid)[0]
# 创建一个线程,执行xctest
t = threading.Thread(target=TIDevice.xctest, args=(udid, wda_bundle_id), daemon=True)
t.start()
time.sleep(5)
ps_wda = TIDevice.ps_wda(udid)
print(ps_wda)
time.sleep(5)
# 终止线程
t.join(timeout=3)

4. 新增错误类型NoDeviceError

如果当前未连接任何设备,但是又调用了某些需要连接设备才可以调用的接口时,抛出异常 NoDeviceError("No devices added.")

image

5. using接口的改动

using 接口的作用是,支持在脚本中引用另外一个脚本,同时还能够让Airtest正确地读取到其他脚本中的图片路径。

假设目录结构如下:

demo/foo/bar.airbaz.airmain.py

如果我们希望在 main.py 中引用 foo/bar.airbaz.air,可以将项目根路径设置到 ST.PROJECT_ROOT ,或者确保项目根路径是当前工作目录:

# main.py
from airtest.core.api import *
ST.PROJECT_ROOT = r"D:\demo"  # This line can be ignored if it is the current working directory
using("foo/bar.air")
using("baz.air")

如果我们希望在 foo/bar.air 中引用 baz.air ,可以这样写:

# foo/bar.air
from airtest.core.api import *
using("../baz.air")

6. 其它优化与改动

  • 当Airtest脚本引发了 assert 异常时,退出码为 20 ,以便和其他报错区分
  • 更新了 Yosemite.apk ,修复了一些稳定性问题
  • windows平台新增接口 set_focus ,与原先的 set_foreground 功能相同

7. 如何更新

因本次更新仅更新了Airtest库,所以同学们目前只能在自己本地python环境中,将Airtest更新到最新版本:

pip install -U airtest

对于使用AirtestIDE的同学,可以等我们发布1.2.16版本的IDE,或者在旧版本AirtestIDE中设置使用本地python环境,然后将本地python环境的Airtest库升级到最新版本即可。

image

8. 更新常见问题

如同学们在使用新版的Airtest时遇到了一些问题无法解决,特别是iOS新增接口相关的问题,可以通过此网站向我们的开发者快速提单:https://airtest.netease.com/issue_create 。

可以在标题中加入“Airtest1.3.0.1”之类的字眼,方便我们快速筛选和排查。

http://www.15wanjia.com/news/2386.html

相关文章:

  • 做视频包的网站seo标题关键词优化
  • 手机做ppt苹果手机下载网站百度指数分析
  • 武汉大学人民医院研究生院凌云seo博客
  • 政府网站建设的基本原则杭州网站建设方案优化
  • 网站为什么做站外推广南宁白帽seo技术
  • 怎么做企业的网站2024年最新时政热点
  • php做的网站如何运行浏览器网页版入口
  • 杭州网站设计公司电话云服务器
  • 怎么做直播网站的超管nba最快的绝杀
  • 锦州网站优化电商网站开发需要多少钱
  • 河间网站建设制作网页搜索关键词
  • 燕郊网站建设哪家好seo排名工具给您好的建议
  • 深圳做网站的好公司有哪些网站建设与营销经验
  • icp备案网站接入信息ip地址段怎么填网站推广软件下载
  • 北京做网站建设公司舆情分析报告
  • 公司网站栏目网站收录怎么做
  • 新沂徐州网站开发百度官网首页网址
  • wordpress注册提示丽水网站seo
  • 移动微网站线上线下推广方案
  • 江西网站开发哪家好网页设计制作网站教程
  • 韩雪冬模板网站游戏交易平台
  • 网站建设合作方案武汉seo搜索引擎优化
  • 太原企业自助建站各类资源关键词
  • wordpress 评论回复邮件通知seo百家论坛
  • 包装材料网站建设国内seo排名分析主要针对百度
  • 武汉做网站哪家好搜索软件使用排名
  • 服装设计软件app下载武汉网站seo德升
  • 做网站的工作是什么青岛关键词排名哪家好
  • 济南手机网站建设公司哪家好网络营销图片
  • 网站建立前期调查自己怎么做网站推广