irpas技术客

iOS自动化测试-使用真机进行自动化测试_Ye_xiaoMing_ios 自动化测试

大大的周 7969

1、运行iOS程序到真机

1.1 在Xcode中登录自己的Apple ID

1.2 配置开发者信息

1.3 选择将要运行的程序和设备

1.4 快捷键 command+r 运行

1.5 在手机中进入 设置-通用-设备管理-自己的Apple ID-信任程序

1.6 重新 command+r 运行

2、配置WebDriveAgent

2.1 进入到下载的WebDriveAgent项目下

2.2 输入命令?

./Scripts/bootstrap.sh

2.3 启动 WebDriveAgent.xcodeproj

2.4 配置?WebDriveAgentLib 的开发者信息

2.5 配置?WebDriveAgentRunner 的开发者信息

2.6 配置 IntegrationApp 的开发者信息

2.7 修改?WebDriveAgentRunner 的 Product Bundle Identifier

2.8 修改?IntegrationApp 的 Product Bundle Identifier

2.9 数据线连接真机

2.10 选择将要运行的?WebDriveAgentRunner 和 真机设备

2.11 使用 command+u 运行

稍等之后会在log中出来一个url地址在浏览器中打开这个地址,如果显示一串json数据,即为正确连接手机并且,真机会多一个程序

2.12 将配置好的?WebDriveAgent 项目替换到 appium 的?WebDriveAgent 项目

打开 finder快捷键 command+shift+g输入路径 /Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver回车将旧项目换个名字,当作备份将配置好的项目放在这个目录下 3、运行自动化脚本

3.1 编写前置代码

3.2 查看 udid 并增加为启动参数

可在 Xcode 选择 Window - Devices and Simulators - Devices - 复制 Identifier

3.3 运行即可

from appium import webdriver # 前置代码 desired_caps = dict() desired_caps['platformName'] = 'iOS' desired_caps['platformVersion'] = 'xxx' desired_caps['deviceName'] = 'iPhone xxx' desired_caps['app'] = 'com.xxx.xxx' # 真机需要使用的参数 desired_caps['udid'] = 'xxxxxxxx' deriver = webdriver.Remote('http;//localhost:4723/wd/hub', desired_caps)


1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,会注明原创字样,如未注明都非原创,如有侵权请联系删除!;3.作者投稿可能会经我们编辑修改或补充;4.本站不提供任何储存功能只提供收集或者投稿人的网盘链接。

标签: #iOS #自动化测试