Appium_ios自动化问题汇总

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, assignreadonlyHTTPConnection *connection;

修改为:@property (nonatomicstrongreadonlyHTTPConnection *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
大功告成,终于出结果了。。


 

 

 

 

posted @ 2020-03-19 20:10  jiguanghover  阅读(1793)  评论(0编辑  收藏  举报