Appium(和桌面)无法启动 wda 会话,因为 xCode13 和 iOS15

Appium (and desktop) unable to launch wda session since xCode13 and iOS15

由于我的 xCode 已(自动...)更新到 13,并且我所有的模拟器都从 iOS 14.5 移动到 15。使用相同的设置/命令我无法启动来自桌面应用程序和节点的 WDA(硒服务器 grid/node 设置)

所有模拟器都存在该问题。 我还能用真机..

(错误的实际端口可能不同,第一个来自失败的实际自动化,第二个和第三个来自桌面应用程序 - 它仍然失败并出现相同的错误。根本问题仍然存在两者相同)

我得到的错误日志: 简而言之:

org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Unable to start WebDriverAgent session because of xcodebuild failure: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8205
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'Janoss-MacBook-Pro.local', ip: 'fe80:0:0:0:18e4:52:307c:8c7b%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '11.5', java.version: '11.0.11'
Driver info: driver.version: IOSDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Unable to start WebDriverAgent session because of xcodebuild failure: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8205
    at getResponseForW3CError (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:804:9)
    at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:380:37)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'Janoss-MacBook-Pro.local', ip: 'fe80:0:0:0:18e4:52:307c:8c7b%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '11.5', java.version: '11.0.11'
Driver info: driver.version: IOSDriver

来自服务器的较长错误:

[iOSSim] Got Simulator UI client PID: 11815
[iOSSim] Both Simulator with UDID 'F5A500AB-FAA5-41A0-A009-E5A8EDB8643A' and the UI client are currently running
[BaseDriver] Event 'simStarted' logged at 1632487969688 (14:52:49 GMT+0200 (Central European Summer Time))
[WebDriverAgent] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found
[DevCon Factory] Requesting connection for device F5A500AB-FAA5-41A0-A009-E5A8EDB8643A on local port 8100
[DevCon Factory] Cached connections count: 0
[DevCon Factory] Successfully requested the connection for F5A500AB-FAA5-41A0-A009-E5A8EDB8643A:8100
[XCUITest] Starting WebDriverAgent initialization with the synchronization key 'XCUITestDriver'
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[WD Proxy] connect ECONNREFUSED 127.0.0.1:8100
[WebDriverAgent] WDA is not listening at 'http://127.0.0.1:8100/'
[WebDriverAgent] WDA is currently not running. There is nothing to cache
[XCUITest] Trying to start WebDriverAgent 2 times with 10000ms interval
[XCUITest] These values can be customized by changing wdaStartupRetries/wdaStartupRetryInterval capabilities
[BaseDriver] Event 'wdaStartAttempted' logged at 1632487969773 (14:52:49 GMT+0200 (Central European Summer Time))
[WebDriverAgent] Launching WebDriverAgent on the device
[WebDriverAgent] WebDriverAgent does not need a cleanup. The sources are up to date (1620631774000 >= 1620631774000)
[WebDriverAgent] Killing running processes 'xcodebuild.*F5A500AB-FAA5-41A0-A009-E5A8EDB8643A, F5A500AB-FAA5-41A0-A009-E5A8EDB8643A.*XCTRunner, xctest.*F5A500AB-FAA5-41A0-A009-E5A8EDB8643A' for the device F5A500AB-FAA5-41A0-A009-E5A8EDB8643A...
[WebDriverAgent] 'pgrep -if xcodebuild.*F5A500AB-FAA5-41A0-A009-E5A8EDB8643A' didn't detect any matching processes. Return code: 1
[WebDriverAgent] 'pgrep -if F5A500AB-FAA5-41A0-A009-E5A8EDB8643A.*XCTRunner' didn't detect any matching processes. Return code: 1
[WebDriverAgent] 'pgrep -if xctest.*F5A500AB-FAA5-41A0-A009-E5A8EDB8643A' didn't detect any matching processes. Return code: 1
[WebDriverAgent] Beginning test with command 'xcodebuild build-for-testing test-without-building -project /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=F5A500AB-FAA5-41A0-A009-E5A8EDB8643A IPHONEOS_DEPLOYMENT_TARGET=15.0 GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO' in directory '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent'
[WebDriverAgent] Output from xcodebuild will only be logged if any errors are present there. To change this, use 'showXcodeLog' desired capability
[WebDriverAgent] Waiting up to 60000ms for WebDriverAgent to start
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[WD Proxy] connect ECONNREFUSED 127.0.0.1:8100
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[WD Proxy] connect ECONNREFUSED 127.0.0.1:8100

然后等待很长时间,只有 ECONNREFUSED 错误,最后失败了:

[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[WD Proxy] connect ECONNREFUSED 127.0.0.1:8100
[XCUITest] Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100). Retrying...
[XCUITest] UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100
[XCUITest]     at JWProxy.command (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:274:13)
[XCUITest]     at runMicrotasks ()
[XCUITest]     at processTicksAndRejections (internal/process/task_queues.js:85:5)
[XCUITest] Unable to start WebDriverAgent session because of xcodebuild failure: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100
[XCUITest] Quitting and uninstalling WebDriverAgent
[WebDriverAgent] Shutting down sub-processes
[iOSSim] Building bundle path map
[iOSSim] The simulator has '1' bundles which have 'WebDriverAgentRunner-Runner' as their 'CFBundleName':
[iOSSim]     'com.jano.facebook.WebDriverAgentRunner.xctrunner'
[WebDriverAgent] Uninstalling WDAs: 'com.jano.facebook.WebDriverAgentRunner.xctrunner'
[XCUITest] {}
[DevCon Factory] Releasing connections for F5A500AB-FAA5-41A0-A009-E5A8EDB8643A device on any port number
[DevCon Factory] Found cached connections to release: ["F5A500AB-FAA5-41A0-A009-E5A8EDB8643A:8100"]
[DevCon Factory] Cached connections count: 0
[XCUITest] Not clearing log files. Use `clearSystemFiles` capability to turn on.
[IOSSimulatorLog] Stopping iOS log capture
[BaseDriver] Event 'newSessionStarted' logged at 1632488146662 (14:55:46 GMT+0200 (Central European Summer Time))
[MJSONWP] Encountered internal error running command: Error: Unable to start WebDriverAgent session because of xcodebuild failure: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100
[MJSONWP]     at quitAndUninstall (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:544:15)
[MJSONWP]     at /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:610:11
[MJSONWP]     at wrapped (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:60:13)
[MJSONWP]     at retry (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:43:13)
[MJSONWP]     at retryInterval (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:70:10)
[MJSONWP]     at /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:559:7
[HTTP] <-- POST /wd/hub/session 500 177858 ms - 388
[HTTP] 
[HTTP] --> DELETE /wd/hub/session

为了解决这个问题, 我们需要在电脑上更新我们的appkum(应该是1.22.0或以上)

查看您的版本:

appium -v

要安装/更新您的 appium:

npm install -g appium

这修复了模拟器部分。要修复 appium 桌面,您还必须更新桌面应用程序,但现在它已作为 2 个单独的应用程序移动。

服务器一个 https://github.com/appium/appium-desktop/releases/

还有一个给检查员 https://github.com/appium/appium-inspector/releases

我在旧的 appium(服务器和检查器结合在一起)和新版本中遇到了类似的问题,它们是分开的。

我通过添加服务器功能解决了这个问题:

serverCapabilities.setCapability("wdaStartupRetries", "4");
serverCapabilities.setCapability("iosInstallPause","8000" );
serverCapabilities.setCapability("wdaStartupRetryInterval", "20000");

此后,wda会话稳定