iOS自动化测试-appium

准备工具

Python
Xcode
node:brew install node
brew:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
libimobiledevice:brew install libimobiledevice --HEAD
carthage:brew install carthage
ideviceinstaller:brew install ideviceinstaller
ios-deploy: brew install ios-deploy(npm install ios-deploy及(sudo npm install -g ios-deploy --unsafe-perm=true) 用这些命令安装在10.15上均失败,在10.14.6上成功)
xcpretty:gem install xcpretty
appium:npm install -g appium
appium-doctor:npm install -g appium-doctor

下载WebDriverAgent

https://github.com/appium/WebDriverAgent
(https://github.com/facebookarchive/WebDriverAgent这个下载之后在我电脑上总是报错Could not build module 'RoutingHTTPServer'
解决办法:将WebDriverAgent/Carthage/Cartfile.resolved里面的github "appium/RoutingHTTPServer" "v1.0.1"改成github "appium/RoutingHTTPServer" "v1.1.0"
然后执行:./Scripts/bootstrap.sh)
执行脚本./Scripts/bootstrap.sh
把WebDriverAgent复制到/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/
打开WebDriverAgent.xcodeproj
使用comand+U拿到ServerURLHere
ServerURLHere拼接上/status,如http://192.168.0.186:8100/status 在浏览器中打开
得到一个json字符串表示成功
{ "value" : { "message" : "WebDriverAgent is ready to accept commands", "state" : "success", "os" : { "name" : "iOS", "version" : "13.2.2", "sdkVersion" : "13.0" }, "ios" : { "simulatorVersion" : "13.2.2", "ip" : "192.168.0.186" }, "ready" : true, "build" : { "time" : "Nov 15 2019 16:39:58", "productBundleIdentifier" : "com.facebook.WebDriverAgentRunner" } }, "sessionId" : "978440BB-50FB-4905-A3B4-737641777CC2" }

如果无法访问ServerURLHere,需要转发端口
brew install libimobiledevice
iproxy 8100 8100

你可能感兴趣的:(iOS自动化测试-appium)