Appium,安裝WebDriverAgent(WDA)


前提說明:Appium通過WebDriverAgent來操作iOS,所以需要在Appium下安裝一份WebDriverAgent,並且將程序安裝到iOS真機上
(如果是模擬器不需要這步驟)
 
環境:Xcode11.3
 
WebDriverAgent安裝步驟
1.cd  /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
 
目錄在appium安裝目錄下,具體路徑參照自己的路徑,可以通過find命令查找
可以安裝appium后用其自帶的WebDriverAgent,也可以直接在官網下載后自己去編譯:https://github.com/facebook/WebDriverAgent 
 
2.在當前目錄下執行腳本
sh ./Scripts/bootstrap.sh
 
3.編譯WebDriverAgent.xcodeproj
打開當前目錄下的WebDriverAgent.xcodeproj文件(工程文件在第1步的目錄下)
 
注意:build時需要指定一個Development team,可以用個人Apple ID賬號,生成個人證書和team(在Xcode->Preferences->Account中配置)
 
PROJECT->WebDriverAgent、TARGETS->WebDriverAgentLib和WebDriverAgentRunner的Signing使用個人的證書和Team(畫黑色橫線的部分)
 
TARGETS->WebDriverAgentLib和WebDriverAgentRunner的Product Bundle Identifier使用一個新名字,因為Bundle ID不能重復
 
點擊Product->Build,將工程文件編譯一下
 
4.測試一下,然后手機上信任證書
還是在WebDriverAgent目錄下,執行下面的命令來測試一下是否生效了
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=你的udid' test
 
如果沒有報錯證明安裝成功,同時手機上會安裝一個WebDriverAgent軟件
 
說明:如果編譯WebDriverAgent時使用了自己的證書,需要再手機設置->通用里信任一下證書
 
測試WebDriverAgent時遇到的問題1:
Testing failed:
    Signing for "WebDriverAgentRunner" requires a development team. Select a development team in the project editor.
    Code signing is required for product type 'UI Testing Bundle' in SDK 'iOS 10.3'
需要下圖的這兩個target都配置一下debug的證書和配置文件,然后編譯
 
測試WebDriverAgent時遇到的問題2:
Testing failed:
    Test target WebDriverAgentRunner encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted)
 
解決方法:
進入手機的設置->通用->描述文件與設備管理,信任編譯WebDriverAgent時選擇的證書
然后再執行該命令就可以了
 
 

 

遇到的問題:

問題1:RoutingHTTPServer/RoutingConnection.h' file not found
解決方法:進入webdriveragent下載目錄,執行腳本下載依賴
cd  /Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/WebDriverAgent
sh ./Scripts/bootstrap.sh
 
問題2:Could not build module ‘RoutingHTTPServer’和'assign' property of object type may become a dangling reference;consider using 'unsafe_unretained'
環境:xcode11.3,手機ios13.5
解決方法:給手機安裝的時候報錯,找到報錯assign的那行,將assign替換為unsafe_unretained


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM