不通过 appium 直接启动 wda 并获取页面 source 控件树
通过命令行开启:
/usr/bin/xcodebuild build-for-testing test-without-building -project /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=请传入设备的udid USE_PORT=8100 test
以 8300 端口代理 8100 端口
iproxy 8300 8100 设备udid
浏览器中访问
http://localhost:8300/status
返回信息如下 拿到 session ID
{
sessionId: "97CC1D84-B3C4-467E-A1F2-BC004602DC72",
value: {
state: "success",
os: {
sdkVersion: "11.3",
name: "iOS",
version: "10.3.3",
},
ios: {
ip: "172.24.34.73",
simulatorVersion: "10.3.3",
},
build: {
time: "Jul 31 2018 19:46:43"
},
},
status: 0,
}
http://localhost:8300/session/97CC1D84-B3C4-467E-A1F2-BC004602DC72/source
即可获得与 appium page_source 一样的返回结果