环境版本

IMAC: Ventura 13.0.1 (当前最新)
XCODE: Version 14.1 (当前最新)
Iphone7: 15.7.1
iTunes: windows64 12.12.6.1(当前最新)

基本架构


1、手机端的WDA Runner(WebDriverAgent)类似于appium测试框架中的 UIAutomator Server,
将接收到的控制命令转换为XCUITest 相关API操作,实现对应用界面的控制。WebDriverAgent应用需要通过xcode编译安装。
2、WDA的启动可以使用阿里开源的tidevice工具。
3、Language Bindings为不同语言的自动化测试脚本,比如基于python语言的facebook-wda,基于go语言的gwda等。

usbmuxd

usbmux通信协议:实现 Mac/Windows/Linux与 iOS设备服务间的通信
Mac端
usbmuxd 是usbmux协议在macOS平台的上实现,也是macOS系统上的一个守护进程,它随着系统的启动而启动。用于在USB协议上实现多路TCP连接,将USB通信抽象为TCP通信。苹果的iTunes、Xcode,都直接或间接地用到了这个服务。

Linux 端
本身是没有 usbmuxd的,不过都有开源项目的实现,可以直接使用
安装:sudo apt-get install usbmuxd
启动:sudo systemctl start usbmuxd

Windows端
另外依赖 AppleApplicationSupport和AppleMobileDeviceSupport 两个服务,安装Itunes 环境即可安装对应服务。
或者单独安装这两个服务

WDA安装

Iphone端安装需要:MAC电脑、Xcode、WebDriverAgent

  1. 下载 WebDriverAgent
    https://github.com/appium/WebDriverAgent
  2. 打开项目,找到WebDriverAgent.xcodeproj,双击打开
  3. 登录Apple ID
  4. 参数设置
    需要设置三个位置


    第三个参数,若是有开发者权限的,不需要设置
  5. 选择真机
    Product—Destination—myphone
  6. 运行工程

    此时会在iphone手机上看到WebDriverAgent

启动WDA

tidevice

可以通过tidevice在windows上启动iphone端的WebDriverAgent
github地址:https://github.com/alibaba/taobao-iphone-device

# Recommend 安装
pip3 install -U "tidevice[openssl]"  
# 启动
tidevice -u 2ed5c397b015exxxxxxxx065ce4dece468 wdaproxy -B com.facebook.WebDriverAgentRunner.xienova.xctrunner --port 8100 

Using Xcode

Simply open WebDriverAgent.xcodeproj and start WebDriverAgentRunner test.

Using xcodebuild

xcodebuild -project WebDriverAgent.xcodeproj \
           -scheme WebDriverAgentRunner \
           -destination 'platform=iOS Simulator,name=iPhone 6' \
           test

自动化操作

Facebook-wda

Facebook-wda实现的功能类似于Android中的uiautomator2,可以实现对手机的自动化操作
github地址:https://github.com/openatx/facebook-wda

pip3 install -U facebook-wda

Xcode/MAC OS/IOS版本对应关系

可以在苹果官网查看
https://developer.apple.com/cn/support/xcode/

版权声明:本文为qev211原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/qev211/p/16936448.html