1、安装Homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2、安装carthage:
brew install carthage
3、安装python:
brew install python
4、安装node:
brew install node
5、克隆WebDriverAgent到本地:
git clone https://github.com/facebook/WebDriverAgent
6、切换到WebDriverAgent目录,执行:
cd ./WeDriverAgent/
//执行脚本
./Scripts/bootstrap.sh
7、xcode使用
因为安装到真机上都是需要证书签名的,需要先在xcode中设置账号。
如果是免费版的个人证书,还需要修改下WebDriverAgent的BundleID,主要不和别人的重名就行。【】注意不仅要改Lib,runner下的BundleId也要改【】
z运行与测试
到此,基本环境就搭建好了,为了验证是否能够真正的运行,下面进行简单的运行测试。
最后运行 Product ->Test选项,一切正常的话,手机上会出现一个无图标的WebDriverAgent应用。
测试WebDriverAgent
打开浏览器safari,在地址栏输入:127.0.0.1:8100/inspector 回车 看到 下图说明正确。
8、ATX安装和使用
pip install --pre --upgrade atx
pipinstall opencv_python
python脚本:
import atx
d = atx.connect('http://localhost:8100', platform='ios')
print d.status()
官方文档:
https://github.com/facebook/WebDriverAgent/wiki/Queries
端口开发:
brewuninstall ideviceinstaller -g
brew uninstall libimobiledevice -g
brew install --HEAD libimobiledevice -g
brew install ideviceinstaller -g
sudo chmod -R 777 /var/db/lockdown
设置代理:
把当前链接的iOS设备端口转发到MacOS的端口
iproxy8100 8100
完成后,可以使用http://localhost:8100/status查看是否返回JSON
http://localhost:8100/inspector访问