mac配置python+appium--iOS版-真机(三)

本节来看看真机上appium如何启动ios的app

1、安装Carthage

brew install carthage

2、安装依赖:
Appium iOS真机测试依赖于中心第三方软件套件:libimobiledevice, 用homebrew安装:

brew install libimobiledevice

Appium支持真机在iOS 9.3以上版本使用Xcode 8+ 还要依赖于ios-deploy,通过npm安装:

npm install -g ios-deploy

3、 安装WebDriverAgent项目,appium一般自带了

自带:

Appium.app->右键-显示包内容->Contents,然后搜索WebDriverAgent.xcodeproj,点击在上层文件夹中显示,将新打开的文件,全部复制到一个新的文件夹中。

没自带,下载:

https://github.com/facebookarchive/WebDriverAgent

可以直接下载,也可以命令行使用git下载:

git clone https://github.com/facebookarchive/WebDriverAgent.git  

下载之后进入WebdriverAgent的路径中执行:

cd WebDriverAgent

./Scripts/bootstrap.sh

4、Xcode打开项目,配置证书

配置WebDriverAgentLib,Team输入苹果账号密码

配置WebDriverAgentRunner

 如图所示,会出现报错提示,进入WebDriverAgentRunner -> Build Settings设置中,找到Packaging中的选项,将其内容修改为唯一识别的字符串:

再回来看报错信息就没有了

 5、Product>Destination,选择你的设备

 Product>Scheme,选择WebDriverAgent

 6、Product>Test,运行项目

这个时候手机上会成功安装上WebDriverAgent,首次安装需要手机上设置信任,路径为设置>通用>描述文件与设备管理,找到WebDriverAgent并设置信任

7、点击图中的图标或View>Debug Area>Activate Console可以查看控制台日志

浏览器中输入127.0.0.1:8100/status返回一串字符串则成功

如果没有返回内容,则需要做端口转发,命令行输入:

brew install libimobiledevice --HEAD

iproxy 8100 8100

再次刷新页面即加载成功

8、appium inspector中连接手机


{
  "appium:platformVersion": "14.4.1",
  "platformName": "iOS",
  "appium:automationName": "XCUITest",
  "appium:deviceName": "iPhone Xs",
  "appium:bundleId": "com.xxx.xx",
  "appium:udid": "xx"
}

  "appium:automationName": "XCUITest",这一行可以不填

platformVersion、deviceName、udid、bundleId可以在Xcode中查看

Window>Devices and Simulators

点击Open Console查看app的bundleId

运行app,在process列中找到SpringBoard, Message列中找到 Bootstrapping, bundleId 类似于com.xxxx.xxx.xxx

appium inspector中执行json,如果出现Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65,拔出USB再插上试试...,需要注意的是,必须先在Xcode中运行WebDriverAgent,再使用appium调用app。

如果出现Could not determine Xcode version /Library/Developer/Info.plist does not exist on disk

命令行输入

sudo xcode-select --reset

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值