mac搭建ios自动化环境之WebDriverAgent配置
一、WebDriverAgent
1、簡單介紹:
WebDriverAgent是facebook為蘋果公司開發的一款自動化測試工具,github上有下載資源;另外appium安裝后也會自動安裝自帶的WebDriverAgent;可以用自帶的,也可以從github下載并替換自帶的;
2、不同appium版本自帶WebDriverAgent默認路徑不同
1)appium 1.10.1之前版本:
npm方式安裝:
/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
desktop安裝:
/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
2)appium 1.10.1之后版本:
npm方式安裝:
/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent
desktop安裝:
/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent
appium日志中可以看到自動化使用的WebDriverAgent路徑(敲黑板!!!重點哦,有時我們在非默認路徑下設置好了WebDriverAgent,但運行的時候發現并沒有按照我們設置的參數運行或出現一些錯誤,很可能就是因為走了默認路徑從而沒有用到我們的設置,理論上appium應該有自定義WebDriverAgent路徑的功能,當然就用它的默認路徑也沒問題,直接在該路徑下設置行啦)
[WebDriverAgent] Using WDA path: '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent' [WebDriverAgent] Using WDA agent: '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj' [WebDriverAgent] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found3、WebDriverAgent下載依賴、配置bundle_id和簽名(以appium自帶的為例)
1)cd WebDriverAgent:進入該文件夾
2)./Scripts/bootstrap.sh:運行初始化腳本,不報錯即可;若存在ERROR in ./js/app.js Module
parse failed:/app.js Unexpected token
報錯信息,參考文章:https://blog.csdn.net/qq_33004389/article/details/89454505
3)在xcode中打開WebDriverAgent.xcodeproj文件; 4)設置bundle_id:
Target—>WebDriverAgentRunner、UnitTests、IntegrationTests_1、IntegrationTests_2、IntegrationTests_3、IntegrationApp(最好都按后面依次設置下)—>build
settings—>Product Bundle Identifier(設置bundle_id為唯一值) 5)簽名:
General—>Signing—>team—>選擇appleId(自己的或團隊的都行)—>參照上面都設置下;
6)測試WebDriverAgent:
左上角—>Scheme務必選擇WebDriverAgentRunner—>Simulator選擇真機或模擬器(以上bundleId和簽名的設置都是針對真機測試的,若用模擬器理論上都不用設置這些;我用的模擬器但是我也都設置了,這當然也沒問題啦,以后用真機的時候就不用再設置了,更好呢)—>Product—>Test,此時設備上就會安裝好WebDriverAgentRunner啦。
二、iphone真機與simulator區別
ios 真機:
1)可以運行.ipa包和.app包;
2).app包必須是在真機環境下編譯才可在真機運行;
ios simulator:
1)只能運行.app包;
2).app包必須是在simulator環境下編譯才可在simulator運行;
總結
以上是生活随笔為你收集整理的mac搭建ios自动化环境之WebDriverAgent配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: appium适用场景
- 下一篇: mac搭建appium自动化之testN