我正在尝试在 iOS 上运行一些 appium 测试,似乎 WebDriverAgent 永远不会启动的时间大约有一半。我在 appium 日志中一遍又一遍地收到此错误:
[debug] [simctl] WD Proxy Matched '/status' to command name 'getStatus'
[debug] [simctl] WD Proxy Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[simctl] WD Proxy connect ECONNREFUSED 127.0.0.1:8100
[debug] [simctl] WD Proxy Matched '/status' to command name 'getStatus'
[debug] [simctl] WD Proxy Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[simctl] WD Proxy connect ECONNREFUSED 127.0.0.1:8100
[debug] [simctl] WD Proxy Matched '/status' to command name 'getStatus'
[debug] [simctl] WD Proxy Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[simctl] WD Proxy connect ECONNREFUSED 127.0.0.1:8100
在这种情况发生一段时间后,我将重新启动服务器并重试。通常情况下,我会收到几次该错误,但随后 WebDriverAgent 服务器将启动:
debug] [simctl] WD Proxy Matched '/status' to command name 'getStatus'
[debug] [simctl] WD Proxy Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[simctl] WD Proxy connect ECONNREFUSED 127.0.0.1:8100
[debug] [simctl] WD Proxy Matched '/status' to command name 'getStatus'
[debug] [simctl] WD Proxy Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[simctl] WD Proxy connect ECONNREFUSED 127.0.0.1:8100
[debug] [simctl] WD Proxy Matched '/status' to command name 'getStatus'
[debug] [simctl] WD Proxy Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[simctl] WD Proxy connect ECONNREFUSED 127.0.0.1:8100
[debug] [simctl] WebDriverAgent Log file for xcodebuild test: /Users/kroe761/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu/Logs/Test/Test-WebDriverAgentRunner-2020.10.15_11-20-17--0500.xcresult/Staging/2_Test/Diagnostics/WebDriverAgentRunner-27B846BD-B71B-4DA7-910B-ABEB46E5890F/WebDriverAgentRunner-7B63C34A-8F4F-4B67-AD6F-3F34C50C4DF1/Session-WebDriverAgentRunner-2020-10-15_112018-MRGyT7.log
[debug] [simctl] WD Proxy Matched '/status' to command name 'getStatus'
[debug] [simctl] WD Proxy Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[simctl] WD Proxy connect ECONNREFUSED 127.0.0.1:8100
[debug] [simctl] WD Proxy Matched '/status' to command name 'getStatus'
[debug] [simctl] WD Proxy Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[debug] [simctl] WD Proxy Got response with status 200: {"value":{"message":"WebDriverAgent is ready to accept commands","state":"success","os":{"testmanagerdVersion":28,"name":"iOS","sdkVersion":"14.0","version":"14.0"},"ios":{"simulatorVersion":"14.0","ip":"172.21.99.125"},"ready":true,"build":{"upgradedAt":"1602686780985","time":"Oct 15 2020 10:58:44","productBundleIdentifier":"com.facebook.WebDriverAgentRunner"}},"sessionId":null}
[debug] [simctl] WebDriverAgent WebDriverAgent information:
[debug] [simctl] WebDriverAgent {
[debug] [simctl] WebDriverAgent "message": "WebDriverAgent is ready to accept commands",
[debug] [simctl] WebDriverAgent "state": "success",
[debug] [simctl] WebDriverAgent "os": {
[debug] [simctl] WebDriverAgent "testmanagerdVersion": 28,
[debug] [simctl] WebDriverAgent "name": "iOS",
[debug] [simctl] WebDriverAgent "sdkVersion": "14.0",
[debug] [simctl] WebDriverAgent "version": "14.0"
[debug] [simctl] WebDriverAgent },
[debug] [simctl] WebDriverAgent "ios": {
[debug] [simctl] WebDriverAgent "simulatorVersion": "14.0",
[debug] [simctl] WebDriverAgent "ip": "172.xx.xx.xxx"
[debug] [simctl] WebDriverAgent },
[debug] [simctl] WebDriverAgent "ready": true,
[debug] [simctl] WebDriverAgent "build": {
[debug] [simctl] WebDriverAgent "upgradedAt": "1602686780985",
[debug] [simctl] WebDriverAgent "time": "Oct 15 2020 10:58:44",
[debug] [simctl] WebDriverAgent "productBundleIdentifier": "com.facebook.WebDriverAgentRunner"
[debug] [simctl] WebDriverAgent }
[debug] [simctl] WebDriverAgent }
[debug] [simctl] WebDriverAgent WebDriverAgent successfully started after 5889ms
[debug] [simctl] BaseDriver Event 'wdaSessionAttempted' logged at 1602778820361 (11:20:20 GMT-0500 (Central Daylight Time))
[debug] [simctl] XCUITest Sending createSession command to WDA
[debug] [simctl] WD Proxy Matched '/session' to command name 'createSession'
我绝对讨厌“有时会发生这种情况”的问题,但我已经研究了好几天却没有答案。任何帮助,将不胜感激!
编辑:这是我的帽子:
caps = {
platformName: :ios,
deviceName: "iPhone 11",
automationName: "XCUITest",
app: "/path/to/app",
sendKeyStrategy: "setValue",
showXcodeLog: true,
useNewWDA: true
}