1.使用Xcode遇到的問題
xcode-select: error: tool 'instruments' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
解決方法:
報這個錯誤的原因是xcode-select不在默認的路徑
a).找到xcode-select的當前路徑終端命令行
xcode-select --print-path
/Library/Developer/CommandLineTools
b).設置xcode-select到指定位置
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
c) .驗證是否設置成功
xcode-select --print-path
/Applications/Xcode.app/Contents/Developer
2. 查看設備列表
instruments -s devices
3.查看設備udid
xcrun simctl list
4. 'RoutingHTTPServer/RoutingConnection.h' file not found'報錯
問題一:出現'RoutingHTTPServer/RoutingConnection.h' file not found,編譯錯誤.
問題二:xcodebuild failed with code 65
解決處理方法:
4.1.cd /Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/WebDriverAgent
4.2.在wda根目錄下,輸入sh ./Scripts/bootstrap.sh下載依賴,wda重新編譯
4.3.重新build了project后,就沒有報錯了
5. WebDriverAgent/Carthage/Build/iOS/RoutingHTTPServer.framework/Headers/RouteResponse.h:8:1: 'assign' property of object type may become a dangling reference; consider using 'unsafe_unretained'
解決方法:
@property (nonatomic, assign, readonly) HTTPConnection *connection;
修改為:@property (nonatomic, strong, readonly) HTTPConnection *connection;
6. WebDriverAgent/WebDriverAgentLib/Routing/FBWebServer.m:12:9: Could not build module 'RoutingHTTPServer'
解決方法:
@property (nonatomic, assign, readonly) HTTPConnection *connection;
修改為:@property (nonatomic, strong, readonly) HTTPConnection *connection;
7. Simply open WebDriverAgent.xcodeproj
and start WebDriverAgentRunner
test, Using xcodebuild
命令為:xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'platform=iOS Simulator,name=iPhone 11 Pro Max' test
8. testrunner failed: WebDriverAgent/<unknown>: failed: caught "NSInvalidArgumentException", "-[UITestingUITests internalImplementation]: unrecognized selector sent to instance 0x600003c32580"; 此問題通過降低xcode版本解決的,使用最新的xcode版本遇到的問題實在無法解決了;
9. xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination ‘platform=iOS,id=CD7A3E92-9C32-4428-9765-CF99FE14DB10’ test
xcodebuild -project XCTestWD.xcodeproj -scheme XCTestWDUITests -destination id=D45009A8-A070-A7811C, OS=13.3 XCTESTWD_PORT=8001 clean test
結果: xcodebuild: error: option 'Destination' requires at least one parameter of the form 'key=value' , 處理結果:在xcode 11.3.1中應去掉單引號;
10. 命令行執行WebDriverAgentRunner, xcode版本->11.3.1
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=CD7A3E92-9C32-4428-9765-CF99678900, OS=13.3 test
11. App Inspector-ios Macaca:
npm i -g macaca-cli macaca-ios # 安裝命令行工具和驅動模塊
macaca run # 運行即可
12. npm轉cnpm下載(npm下載較慢,轉cnpm國內下載很快):
npm install -g cnpm --registry=https://registry.npm.taobao.org
13. Test XCTestWDUITests
xcodebuild -project XCTestWD.xcodeproj -scheme XCTestWDUITests -destination id=D45009A8-A070-4E6F-84FD-D6744EA7811C, OS=13.3 XCTESTWD_PORT=8001 clean test
14. Macaca捕獲頁面元素
app-inspector -u udid
15. 關閉系統顯示“其他”用戶的設置
sudo defaults write /Library/Preferences/com.apple.loginwindow SHOWOTHERUSERS_MANAGED -bool FALSE
16. 使用app-inspector 報錯: Error: connect ECONNREFUSED 127.0.0.1:8001
解決方法: npm config set proxy null
17. Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: 'bundleId' desired capability not provided
18. An unknown server-side error occurred while processing the command. Original error: No Chromedriver found that can automate Chrome '81.0.4044'. See https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/chromedriver.md for more details. You could also try to enable automated chromedrivers download server feature
解決方法(http://npm.taobao.org/mirrors/chromedriver):
把最新版的chromedriver放置到:\node_modules\appium\node_modules\appium-chromedriver\chromedriver\mac 即可解決問題;
19. ideviceinstaller -l
Could not connect to lockdownd. Exiting
解決方法:
brew uninstall -f libimobiledevice ideviceinstaller usbmuxd如果命令被拒絕,可根據提示,更新命令:
brew uninstall --ignore-dependencies libimobiledevice ideviceinstaller usbmuxd
👌這次命令是成功了
👌然后繼續:
brew install -v --HEAD --fetch --build-
from
-source usbmuxd libimobiledevice ideviceinstaller
ideivesinstaller -l
大功告成,終於出結果了。。