~  

一、android 真机调试连接

1、adb 验证

终端输入 adb,执行结果如下

IOS app真机测试能通过打包APP吗 appium ios真机测试_Mac

 2、连接真机

用数据线将Mac 电脑与android手机连接,在终端输入adb devices,得到android手机的deviceName

如果没有对手机进行授权调试的,记得在android手机的设置打开USB 调试

IOS app真机测试能通过打包APP吗 appium ios真机测试_android_02

3、在appium中配置Desired Capabilities

IOS app真机测试能通过打包APP吗 appium ios真机测试_真机调试_03

 将必填的一些信息填入,步骤2的到的deviceName 就是用在这里啦,根据不同的需求,配置相关的Desired Capabilities,具体配置内容可以查阅官方文档Desired Capabilities - Appium

 4、启动会话

配置完成后,点击右下角的Start Session 就可以启动会话啦,server将给手机安装io.appium.settings 和、io.appium.uiautomator2.server 和io.appium.uiautomator2.server ,从appium的终端可以看到输出日志

IOS app真机测试能通过打包APP吗 appium ios真机测试_android_04

 正确安装后就可以获取到指定app的页面,可以i获取到各个页面元素啦

android真机连接调试,成功!

二、iOS 真机调试连接

1、用数据线将iPhone和Mac电脑连接起来

2、配置webdriveragent

安装了appium server后,就自带appium-webdriveragent

cd /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-WebDriverAgent

该路径下有一个WebDriverAgent.xcodeproj 文件,执行命令

open WebDriverAgent.xcodeproj

IOS app真机测试能通过打包APP吗 appium ios真机测试_Mac_05

接着Xcode会打开这个工程,进入主界面

IOS app真机测试能通过打包APP吗 appium ios真机测试_真机调试_06

 

IOS app真机测试能通过打包APP吗 appium ios真机测试_ios_07

 在上图的这里,一般添加完账号后,会有个报错提醒

IOS app真机测试能通过打包APP吗 appium ios真机测试_ios_08

 这时候要去WebDriverAgentRunner -> Build Settings设置中,找到Packaging中的选项,将其内容修改为唯一识别的字符串就不报错了,如下图所示:

IOS app真机测试能通过打包APP吗 appium ios真机测试_真机调试_09

 运行Product- Test

IOS app真机测试能通过打包APP吗 appium ios真机测试_ios_10

 运行后提示编译成功,接着去IOS设备:
进入设置->通用->描述文件与设备管理,对Apple Development进行信任验证,然后你就会在IOS设备桌面上看见 WebDriverAgent的icon

3、验证

IOS app真机测试能通过打包APP吗 appium ios真机测试_Mac_11

在iPhone设备浏览器输入127.0.0.1:8100/status

如下图则连接成功

IOS app真机测试能通过打包APP吗 appium ios真机测试_真机调试_12

 4、启动appium会话

同样要配置Desired Capabilities,具体配置内容可以查阅官方文档Desired Capabilities - Appium

IOS app真机测试能通过打包APP吗 appium ios真机测试_android_13

 配置完成后,点击右下角的Start Session 就可以启动会话,连接成功。