移动端自动化-IOS之WebDriverAgent安装(二)

配置WebDriverAgent
步骤如下:

  • 进入到WebDriverAgent项目下
  • 命令行输入 ./Scripts/bootstrap.sh
  • 启动WebDriverAgent项目
  • 配置项目信息(开发者信息)具体内容百度

当运行WebDriverAgent时会发生保存,保存信息如下图:移动端自动化-IOS之WebDriverAgent安装(二)
解决方法:双击,进入到报错代码处,修改assign为unsafe_unretained,执行clean and build,错误就没有了
需要添加文件中判断:WebDriverAgent/WebDriverAgentLib/Utilities/FBFailureProofTestCase.m,修改26~36行,添加如下红色代码
if ([self respondsToSelector:@selector(internalImplementation)]) {
self.internalImplementation =
(_XCTestCaseImplementation *)[FBXCTestCaseImplementationFailureHoldingProxy
proxyWithXCTestCaseImplementation:self.internalImplementation];
} else {
self.shouldSetShouldHaltWhenReceivesControl = NO;
self.shouldHaltWhenReceivesControl = NO;
}

由于国内手机设置需要转发下端口,需要在电脑本机命令行 转发端口,命令行执行:iproxy 8300 8100
然后再浏览器里请求:http://localhost:8300/,如果返回一串json字符,那么WDA安装成功了
http://localhost:8300/status可以查看当前设备的状态,获取与wda通信session id
http://localhost:8300/inspector 打开WDA 的inspector,在该界面点击home则手机返回主页面