安装环境:
Mac 10.13.6
Node 7.1.0
Xcode 9.4
iOS 11.4.1 (真机)
步骤:
安装
$brew install carthage (0.31.0,之前安装0.30.0不work)
$git clone https://github.com/facebook/WebDriverAgent
$cd WebDriverAgent
$./Scripts/bootstrap.sh (Terminal报: `$ npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp Dos issue`)
(然后执行:)
$npm update minimatch@3.0.2
$npm update -d
$npm -v minimatch
(版本没变,尝试重新安装)
$npm install -g npm@3
$npm -v minimatch
$3.10.10
(升级成功,重新执行)
$./Scripts/bootstrap.sh
WebDriverAgent.xcodepro配置
1. WebDriverAgent -> Build Settings -> Product Bundle Identifier -> <Change the content to your own>
2. WebDriverAgentLib -> General -> Bundle Identifier -> <Change the content to your own>
3. WebDriverAgentLib -> General -> Check "Automatically manage signing"
4. WebDriverAgentLib -> General -> Team -> Select your own personal certificate
5. WebDriverAgentRunner -> General -> Team -> Select your own personal certificate
6. WebDriverAgentRunner -> Build Settings -> Product Bundle Identifier -> <Change the content to your own>
('Bundle Identifier'可以通过dev获得。)
Run and Test
1. Product -> Destination -> <Choose your own device>.
2. Product -> Scheme -> WebDriverAgentRunner
3. Product -> Test
4. View -> Debug Area -> Activate Console
5. 通过console里给出的IP和端口,加上/status合成一个url地址。例如http://10.0.0.1:8100/status,然后浏览器打开。如果出现一串JSON输出,说明WDA安装成功了。
6. Inspector的地址是http://10.0.0.1:8100/inspector,inspector是用来查看UI的图层,方便写测试脚本用的。