目的
不通过appium直接启动wda并获取页面source控件树
开启wda
通过命令行开启:
/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
开启iproxy 进行端口转发
以8300端口代理8100端口
iproxy 8300 8100 设备udid
获取与wda通信session
浏览器中访问
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,
}
source请求
http://localhost:8300/session/97CC1D84-B3C4-467E-A1F2-BC004602DC72/source
即可获得与appium page_source一样的返回结果
网友评论