问答 问答 关于在 ios 设备上通过 appium 和 webdriveragent 进行自动化测试的一些问题

snakecr7 · 2025年08月21日 · 108 次阅读

想要实现的目标:通过 Wi-Fi 连接 ios 设备然后通过在 ios 设备上安装 webdriveragent 结合 appium 和 python 脚本完成在 ios 设备上的自动化测试

当前遇到的问题:我通过 Xcode 编译 appium 版本的 webdriveragent 工程然后在 iOS 设备上进行 Test 安装之后运行脚本,目前我能够在 iPhone16 pro iOS 版本为 18.0.2 的设备上实现通过 Wi-Fi 连接设备并远程通过 python 脚本实现对于设备的一些简单操控,例如获取屏幕尺寸信息等一些简单操作用于验证通过 Wi-Fi 远程连接 ios 设备并进行脚本自动化测试可行,但是同样的流程更换到其他 ios 设备上时就失败了,想问一下具体原因是什么,是网络连接的问题么?

一些版本配置信息:mac os:15.6;Xcode:16.4;python:3.13;appium:2.19.0;xcuitest:9.10.4;没有安装其他的任何插件

在 iPhone16 pro 上成功的操作步骤:首先通过 usb 和设备相连,通过 xcode build 工程之后通过 test 在 iphone16 pro 上安装 webdriveragent 软件,Mac 和 iPhone 连接同一局域网,Xcode 的 console 中能够正常显示 iPhone 设备的 ip 地址:ServerUrlHere:192.168.1.102:8100 <-ServerUrlHere,同时在 iPhone 设备上通过信任开发者之后 webdriveragent 软件也能够正常运行显示 automation running。之后在 Mac 终端中运行 curl -v http://192.168.1.102:8100/statusjson 显示 wda 软件状态。此时启动 appium 并运行 python 脚本能够正常运行并获取屏幕信息。命令也能够正常返回 然后断开 usb 切换到 Wi-Fi 连接(Xcode 中会显示设备 Wi-Fi 连接图标),此时重复之前有线连接的步骤同样能够奏效。

之后出现的问题:在另一台设备:iPhone13mini ios 版本 18.6 上进行相同的步骤,通过 usb 有线连接的时候能够正常安装 wda,通过 iproxy 端口转发也能够正常运行脚本,但是通过 usb 有线连接安装完 wda 获取到设备 ip 的时候再通过 curl -v 一直会显示连接超时返回不了 json 信息。然后不管是通过有线还是 wifi 连接运行脚本都会出现 server 连接错误,然后 ios 设备上的 wda 软件会被自动卸载,xcode 上出现软件启动错误:The requested application com.facebook.WDAsnake1.xctrunner is not installed. Provide a valid bundle identifier。很想请问各位大佬究竟是因为什么原因导致有的设备可以有的设备不行,同时想问一下 airtest 可以通过 Wi-Fi 无线连接设备么(看官方教程貌似不可以)。如果有大佬能够解答的话可以有偿,感谢感谢。

我的脚本信息如下:
from appium import webdriver
from appium.options.ios import XCUITestOptions
import time

options = XCUITestOptions()
options.platform_name = 'iOS'
options.platform_version = '18.6' #18.6
options.device_name = 'snake' # iPhone13 mini:snake;iPhone16 pro:yuxizhen’s iPhone
options.automation_name = 'XCUITest'
options.udid = '00008110-000C10843AB9801E' #iPhone13 mini:00008110-000C10843AB9801E;iPhone16 pro:00008140-001E4D940882201C
options.show_xcode_log = True

driver = webdriver.Remote('http://localhost:4723,options=options')

driver.implicitly_wait(2)

window_size = driver.get_window_size()
print(f"屏幕尺寸:{window_size}")

driver.quit()

我的 appium 错误 log 信息如下:
[HTTP] Request idempotency key: 464a5add-4575-48bb-a0fe-7427355629fb
[HTTP] --> POST /session {"capabilities":{"firstMatch":[{}],"alwaysMatch":{"appium:automationName":"XCUITest","platformName":"iOS","appium:platformVersion":"18.6","appium:deviceName":"snake","appium:udid":"00008110-000C10843AB9801E","appium:showXcodeLog":true}}}
[AppiumDriver@f9fd] Calling AppiumDriver.createSession() with args: [null,null,{"firstMatch":[{}],"alwaysMatch":{"appium:automationName":"XCUITest","platformName":"iOS","appium:platformVersion":"18.6","appium:deviceName":"snake","appium:udid":"00008110-000C10843AB9801E","appium:showXcodeLog":true}}]
[AppiumDriver@f9fd] Event 'newSessionRequested' logged at 1755744794759 (10:53:14 GMT+0800 (中国标准时间))
[Appium] Attempting to find matching driver for automationName 'XCUITest' and platformName 'iOS'
[Appium] The 'xcuitest' driver was installed and matched caps.
[Appium] Will require it at /Users/jingyi/.appium/node_modules/appium-xcuitest-driver
[Appium] Requiring driver at /Users/jingyi/.appium/node_modules/appium-xcuitest-driver/build/index.js
[AppiumDriver@f9fd] Appium v2.19.0 creating new XCUITestDriver (v9.10.4) session
[AppiumDriver@f9fd] Checking BaseDriver versions for Appium and XCUITestDriver
[AppiumDriver@f9fd] Appium's BaseDriver version is 9.18.0
[AppiumDriver@f9fd] XCUITestDriver's BaseDriver version is 9.18.0
[XCUITestDriver@c613]
[XCUITestDriver@c613] Creating session with W3C capabilities: {
"alwaysMatch": {
"platformName": "iOS",
"appium:automationName": "XCUITest",
"appium:platformVersion": "18.6",
"appium:deviceName": "snake",
"appium:udid": "00008110-000C10843AB9801E",
"appium:showXcodeLog": true
},
"firstMatch": [
{}
]
}
[XCUITestDriver@c613] The desired capabilities include neither an app nor a bundleId. WebDriverAgent will be started without the default app
[f1d008f2][XCUITestDriver@c613] Session created with session id: f1d008f2-24a1-4ace-9053-692f280f9d3d
[f1d008f2][XCUITest] Current user: 'jingyi'
[f1d008f2][XCUITestDriver@c613] Available real devices: 00008110-000C10843AB9801E
[f1d008f2][XCUITestDriver@c613] Creating iDevice object with udid '00008110-000C10843AB9801E'
[f1d008f2][XCUITestDriver@c613] Determining device to run tests on: udid: '00008110-000C10843AB9801E', real device: true
[f1d008f2][XCUITestDriver@c613] Event 'xcodeDetailsRetrieved' logged at 1755744794790 (10:53:14 GMT+0800 (中国标准时间))
[f1d008f2][XCUITestDriver@c613] Event 'appConfigured' logged at 1755744794790 (10:53:14 GMT+0800 (中国标准时间))
[f1d008f2][XCUITestDriver@c613] Event 'resetStarted' logged at 1755744794791 (10:53:14 GMT+0800 (中国标准时间))
[f1d008f2][XCUITestDriver@c613] Reset: running ios real device reset flow
[f1d008f2][XCUITestDriver@c613] Event 'resetComplete' logged at 1755744794791 (10:53:14 GMT+0800 (中国标准时间))
[f1d008f2][XCUITestDriver@c613] Using WDA path: '/Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent'
[f1d008f2][XCUITestDriver@c613] Using WDA agent: '/Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj'
[f1d008f2][XCUITestDriver@c613] The pyidevice tool is not present in PATH. Skipping crash logs collection for real devices.
[f1d008f2][XCUITestDriver@c613] Event 'logCaptureStarted' logged at 1755744795016 (10:53:15 GMT+0800 (中国标准时间))
[f1d008f2][XCUITestDriver@c613] Setting up real device
[f1d008f2][XCUITestDriver@c613] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found
[f1d008f2][DevCon Factory] Requesting connection for device 00008110-000C10843AB9801E on local port 8100, device port 8100
[f1d008f2][DevCon Factory] Cached connections count: 0
[f1d008f2][DevCon Factory] Successfully requested the connection for 00008110-000C10843AB9801E:8100
[f1d008f2][XCUITestDriver@c613] Starting WebDriverAgent initialization with the synchronization key 'XCUITestDriver'
[f1d008f2][WD Proxy] NoSessionProxy options: {"server":"127.0.0.1","port":"8100","base":"","timeout":3000,"scheme":"http","reqBasePath":"","sessionId":null}
[f1d008f2][WD Proxy] Matched '/status' to command name 'getStatus'
[f1d008f2][WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[f1d008f2][XCUITestDriver@c613] Parsed BUILD_DIR configuration value: '/Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/build'
[f1d008f2][XCUITestDriver@c613] Got derived data root: '/Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules'
[f1d008f2][WD Proxy] timeout of 3000ms exceeded
[f1d008f2][XCUITestDriver@c613] WDA is not listening at 'http://127.0.0.1:8100/'. Original error:: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: timeout of 3000ms exceeded
[f1d008f2][XCUITestDriver@c613] WDA is currently not running. There is nothing to cache
[f1d008f2][XCUITestDriver@c613] Trying to start WebDriverAgent 1 times with 10000ms interval
[f1d008f2][XCUITestDriver@c613] These values can be customized by changing wdaStartupRetries/wdaStartupRetryInterval capabilities
[f1d008f2][XCUITestDriver@c613] Event 'wdaStartAttempted' logged at 1755744798134 (10:53:18 GMT+0800 (中国标准时间))
[f1d008f2][XCUITestDriver@c613] Launching WebDriverAgent on the device
[f1d008f2][XCUITestDriver@c613] JWProxy options: {"scheme":"http","server":"127.0.0.1","port":8100,"base":"","timeout":240000,"keepAlive":true,"reqBasePath":"","sessionId":null}
[f1d008f2][XCUITestDriver@c613] NoSessionProxy options: {"scheme":"http","server":"127.0.0.1","port":8100,"base":"","timeout":240000,"keepAlive":true,"reqBasePath":"","sessionId":null}
[f1d008f2][XCUITestDriver@c613] There is no need to perform the project cleanup. A fresh install has been detected
[f1d008f2][WebDriverAgent] Killing running processes 'xcodebuild.*00008110-000C10843AB9801E' for the device 00008110-000C10843AB9801E...
[f1d008f2][WebDriverAgent] 'pgrep -if xcodebuild.*00008110-000C10843AB9801E' didn't detect any matching processes. Return code: 1
[f1d008f2][XCUITestDriver@c613] Beginning test with command 'xcodebuild build-for-testing test-without-building -project /Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -derivedDataPath /Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules -destination id=00008110-000C10843AB9801E IPHONEOS_DEPLOYMENT_TARGET=18.6 GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO' in directory '/Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent'
[f1d008f2][XCUITestDriver@c613] Output from xcodebuild will be logged. To change this, use 'showXcodeLog' desired capability
[f1d008f2][Xcode] Command line invocation:
[f1d008f2][XCUITestDriver@c613] Waiting up to 60000ms for WebDriverAgent to start
[f1d008f2][XCUITestDriver@c613] Matched '/status' to command name 'getStatus'
[f1d008f2][XCUITestDriver@c613] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[f1d008f2][Xcode] /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild build-for-testing test-without-building -project /Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -derivedDataPath /Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules -destination id=00008110-000C10843AB9801E IPHONEOS_DEPLOYMENT_TARGET=18.6 GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO
[f1d008f2][Xcode]
[f1d008f2][Xcode] Build settings from command line:
[f1d008f2][Xcode] COMPILER_INDEX_STORE_ENABLE = NO
[f1d008f2][Xcode] GCC_TREAT_WARNINGS_AS_ERRORS = 0
[f1d008f2][Xcode] IPHONEOS_DEPLOYMENT_TARGET = 18.6
[f1d008f2][Xcode]
[f1d008f2][Xcode] ComputePackagePrebuildTargetDependencyGraph
[f1d008f2][Xcode]
[f1d008f2][Xcode] Prepare packages
[f1d008f2][Xcode]
[f1d008f2][Xcode] CreateBuildRequest
[f1d008f2][Xcode]
[f1d008f2][Xcode] SendProjectDescription
[f1d008f2][Xcode]
[f1d008f2][Xcode] CreateBuildOperation
[f1d008f2][XCUITestDriver@c613] timeout of 1000ms exceeded
[f1d008f2][Xcode]
[f1d008f2][Xcode] ComputeTargetDependencyGraph
[f1d008f2][Xcode] note: Building targets in dependency order
[f1d008f2][Xcode] note: Target dependency graph (2 targets)
[f1d008f2][Xcode] Target 'WebDriverAgentRunner' in project 'WebDriverAgent'
[f1d008f2][Xcode] ➜ Explicit dependency on target 'WebDriverAgentLib' in project 'WebDriverAgent'
[f1d008f2][Xcode] Target 'WebDriverAgentLib' in project 'WebDriverAgent' (no dependencies)
[f1d008f2][Xcode]
[f1d008f2][Xcode] GatherProvisioningInputs
[f1d008f2][Xcode]
[f1d008f2][Xcode] CreateBuildDescription
[f1d008f2][Xcode]
[f1d008f2][Xcode] ExecuteExternalTool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -v -E -dM -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.5.sdk -x objective-c -c /dev/null
[f1d008f2][Xcode]
[f1d008f2][Xcode] ExecuteExternalTool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -v -E -dM -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.5.sdk -x c -c /dev/null
[f1d008f2][Xcode]
[f1d008f2][Xcode] ExecuteExternalTool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -v -E -dM -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.5.sdk -x c -c /dev/null
[f1d008f2][Xcode]
[f1d008f2][Xcode] ExecuteExternalTool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld -version_details
[f1d008f2][Xcode]
[f1d008f2][Xcode] Build description signature: e551c2cd14dd5e309d3044c630e0ac89
[f1d008f2][Xcode] Build description path: /Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules/Build/Intermediates.noindex/XCBuildData/e551c2cd14dd5e309d3044c630e0ac89.xcbuilddata
[f1d008f2][Xcode] /Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 18.6, but the range of supported deployment target versions is 12.0 to 18.5.99. (in target 'WebDriverAgentRunner' from project 'WebDriverAgent')
[f1d008f2][Xcode] /Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj: error: Signing for "WebDriverAgentRunner" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'WebDriverAgentRunner' from project 'WebDriverAgent')
[f1d008f2][Xcode] /Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 18.6, but the range of supported deployment target versions is 12.0 to 18.5.99. (in target 'WebDriverAgentLib' from project 'WebDriverAgent')
[f1d008f2][Xcode] 2025-08-21 10:53:19.750 xcodebuild[9815:412331] Writing error result bundle to /var/folders/hv/m_2n3cvd129_1h5x0ghk77d40000gn/T/ResultBundle_2025-21-08_10-53-0019.xcresult
[f1d008f2][Xcode] xcodebuild: error: Failed writing xctestrun file: The folder “WebDriverAgentRunner_iphoneos18.5-arm64.xctestrun” doesn’t exist..
[f1d008f2][Xcode] xcodebuild exited with code '70' and signal 'null'
[f1d008f2][XCUITestDriver@c613] Event 'wdaStartFailed' logged at 1755744799791 (10:53:19 GMT+0800 (中国标准时间))
[f1d008f2][XCUITestDriver@c613] Error: xcodebuild failed with code 70. This usually indicates an issue with the local Xcode setup or WebDriverAgent project configuration or the driver-to-platform version mismatch. Consider checking the WebDriverAgent configuration guide for real iOS devices at https://appium.github.io/appium-xcuitest-driver/latest/preparation/real-device-config/.
at SubProcess. (/Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/lib/xcodebuild.js:385:25)
at Object.onceWrapper (node:events:622:26)
at SubProcess.emit (node:events:507:28)
at ChildProcess. (/Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules/teen_process/lib/subprocess.js:214:14)
at ChildProcess.emit (node:events:507:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:294:12)
at Process.callbackTrampoline (node:internal/async_hooks:130:17)
[f1d008f2][XCUITestDriver@c613] Unable to launch WebDriverAgent. Original error: xcodebuild failed with code 70. This usually indicates an issue with the local Xcode setup or WebDriverAgent project configuration or the driver-to-platform version mismatch. Consider checking the WebDriverAgent configuration guide for real iOS devices at https://appium.github.io/appium-xcuitest-driver/latest/preparation/real-device-config/.. Make sure you follow the tutorial at https://appium.github.io/appium-xcuitest-driver/latest/preparation/real-device-config/
[f1d008f2][XCUITestDriver@c613] Quitting and uninstalling WebDriverAgent
[f1d008f2][XCUITestDriver@c613] Shutting down sub-processes
[f1d008f2][iProxy@00008110:8100] Failed to receive any data within the timeout: 5000
[f1d008f2][XCUITestDriver@c613] Uninstalling WDAs: 'com.facebook.WDAsnake1.xctrunner'
[f1d008f2][XCUITestDriver@c613] Matched '/status' to command name 'getStatus'
[f1d008f2][XCUITestDriver@c613] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[f1d008f2][iProxy@00008110:8100] Unexpected data: {"header":{"length":294,"version":1,"type":8,"tag":1},"payload":{"MessageType":"Result","Number":2}}
[f1d008f2][XCUITestDriver@c613] socket hang up
[f1d008f2][XCUITestDriver@c613] {}
[f1d008f2][DevCon Factory] Releasing connections for 00008110-000C10843AB9801E device on any port number
[f1d008f2][DevCon Factory] Found cached connections to release: ["00008110-000C10843AB9801E:8100"]
[f1d008f2][DevCon Factory] Releasing the listener for '00008110-000C10843AB9801E:8100'
[f1d008f2][iProxy@00008110:8100] Closing the connection
[f1d008f2][DevCon Factory] Cached connections count: 0
[f1d008f2][XCUITestDriver@c613] Not clearing log files. Use clearSystemFiles capability to turn on.
[f1d008f2][AppiumDriver@f9fd] Event 'newSessionStarted' logged at 1755744800715 (10:53:20 GMT+0800 (中国标准时间))
[f1d008f2][AppiumDriver@f9fd] Encountered internal error running command: Error: Unable to launch WebDriverAgent. Original error: xcodebuild failed with code 70. This usually indicates an issue with the local Xcode setup or WebDriverAgent project configuration or the driver-to-platform version mismatch. Consider checking the WebDriverAgent configuration guide for real iOS devices at https://appium.github.io/appium-xcuitest-driver/latest/preparation/real-device-config/.. Make sure you follow the tutorial at https://appium.github.io/appium-xcuitest-driver/latest/preparation/real-device-config/
at quitAndUninstall (/Users/jingyi/.appium/node_modules/appium-xcuitest-driver/lib/driver.js:846:15)
at /Users/jingyi/.appium/node_modules/appium-xcuitest-driver/lib/driver.js:916:13
at wrapped (/Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules/asyncbox/lib/asyncbox.js:93:13)
at retry (/Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules/asyncbox/lib/asyncbox.js:66:13)
at retryInterval (/Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules/asyncbox/lib/asyncbox.js:103:10)
at /Users/jingyi/.appium/node_modules/appium-xcuitest-driver/lib/driver.js:881:7
[f1d008f2][HTTP] <-- POST /session 500 5973 ms - 1540
[f1d008f2][XCUITestDriver@c613] Matched '/status' to command name 'getStatus'
[f1d008f2][XCUITestDriver@c613] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[f1d008f2][XCUITestDriver@c613] connect ECONNREFUSED 127.0.0.1:8100
[f1d008f2][iProxy@00008110:8100] Unexpected data: {"header":{"length":294,"version":1,"type":8,"tag":1},"payload":{"MessageType":"Result","Number":2}}
[f1d008f2][iProxy@00008110:8100] The connection has been closed
[f1d008f2][XCUITestDriver@c613] Matched '/status' to command name 'getStatus'
[f1d008f2][XCUITestDriver@c613] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[f1d008f2][XCUITestDriver@c613] connect ECONNREFUSED 127.0.0.1:8100
[f1d008f2][XCUITestDriver@c613] Matched '/status' to command name 'getStatus'
[f1d008f2][XCUITestDriver@c613] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[f1d008f2][XCUITestDriver@c613] connect ECONNREFUSED 127.0.0.1:8100
[f1d008f2][XCUITestDriver@c613] Matched '/status' to command name 'getStatus'
[f1d008f2][XCUITestDriver@c613] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[f1d008f2][XCUITestDriver@c613] connect ECONNREFUSED 127.0.0.1:8100
[f1d008f2][XCUITestDriver@c613] Matched '/status' to command name 'getStatus'
[f1d008f2][XCUITestDriver@c613] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[f1d008f2][XCUITestDriver@c613] connect ECONNREFUSED 127.0.0.1:8100
[f1d008f2][XCUITestDriver@c613] Matched '/status' to command name 'getStatus'
[f1d008f2][XCUITestDriver@c613] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[f1d008f2][XCUITestDriver@c613] connect ECONNREFUSED 127.0.0.1:8100
C[Appium] Received SIGINT - shutting down
[AppiumDriver@f9fd] There are no active sessions for cleanup
[HTTP] Closing Appium HTTP server
[HTTP] Appium HTTP server has been successfully closed after 0ms

iphone16 pro wifi 连接脚本运行成功 appium log 如下:
[HTTP] Request idempotency key: 3c4c9dfb-3323-41dd-8ca0-073962d5dcff
[HTTP]->POST/session{"capabilities":{"firstMatch":[{}],"alwaysMatch":{"appium:automationName":"XCUITest","platformName":"iOS","appium:platformVersion":"18.0","appium:deviceName":"yuxizhen’s iPhone","appium:udid":"00008140-001E4D940882201C","appium:showXcodeLog":true}}}
[AppiumDriver@fd5d] Calling AppiumDriver.createSession() with args: [null,null,{"firstMatch":[{}],"alwaysMatch":{"appium:automationName":"XCUITest","platformName":"iOS","appium:platformVersion":"18.0","appium:deviceName":"yuxizhen’s iPhone","appium:udid":"00008140-001E4D940882201C","appium:showXcodeLog":true}}]
[AppiumDriver@fd5d] Event 'newSessionRequested' logged at 1755758765560 (14:46:05 GMT+0800 (中国标准时间))
[Appium] Attempting to find matching driver for automationName 'XCUITest' and platformName 'iOS'
[Appium] The 'xcuitest' driver was installed and matched caps.
[Appium] Will require it at /Users/jingyi/.appium/node_modules/appium-xcuitest-driver
[Appium] Requiring driver at /Users/jingyi/.appium/node_modules/appium-xcuitest-driver/build/index.js
[AppiumDriver@fd5d] Appium v2.19.0 creating new XCUITestDriver (v9.10.4) session
[AppiumDriver@fd5d] Checking BaseDriver versions for Appium and XCUITestDriver
[AppiumDriver@fd5d] Appium's BaseDriver version is 9.18.0
[AppiumDriver@fd5d] XCUITestDriver's BaseDriver version is 9.18.0
[XCUITestDriver@c6a8]
[XCUITestDriver@c6a8] Creating session with W3C capabilities: {
"alwaysMatch": {
"platformName": "iOS",
"appium:automationName": "XCUITest",
"appium:platformVersion": "18.0",
"appium:deviceName": "yuxizhen’s iPhone",
"appium:udid": "00008140-001E4D940882201C",
"appium:showXcodeLog": true
},
"firstMatch": [
{}
]
}
[XCUITestDriver@c6a8] The desired capabilities include neither an app nor a bundleId. WebDriverAgent will be started without the default app
[1f2060a7][XCUITestDriver@c6a8] Session created with session id: 1f2060a7-14ff-4760-8f9d-418b8a849799
[1f2060a7][XCUITest] Current user: 'jingyi'
[1f2060a7][XCUITestDriver@c6a8] Available real devices: 00008140-001E4D940882201C, 00008110-000C10843AB9801E
[1f2060a7][XCUITestDriver@c6a8] Creating iDevice object with udid '00008140-001E4D940882201C'
[1f2060a7][XCUITestDriver@c6a8] Determining device to run tests on: udid: '00008140-001E4D940882201C', real device: true
[1f2060a7][XCUITestDriver@c6a8] Event 'xcodeDetailsRetrieved' logged at 1755758765588 (14:46:05 GMT+0800 (中国标准时间))
[1f2060a7][XCUITestDriver@c6a8] Event 'appConfigured' logged at 1755758765588 (14:46:05 GMT+0800 (中国标准时间))
[1f2060a7][XCUITestDriver@c6a8] Event 'resetStarted' logged at 1755758765588 (14:46:05 GMT+0800 (中国标准时间))
[1f2060a7][XCUITestDriver@c6a8] Reset: running ios real device reset flow
[1f2060a7][XCUITestDriver@c6a8] Event 'resetComplete' logged at 1755758765588 (14:46:05 GMT+0800 (中国标准时间))
[1f2060a7][XCUITestDriver@c6a8] Using WDA path: '/Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent'
[1f2060a7][XCUITestDriver@c6a8] Using WDA agent: '/Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj'
[1f2060a7][XCUITestDriver@c6a8] The pyidevice tool is not present in PATH. Skipping crash logs collection for real devices.
[1f2060a7][XCUITestDriver@c6a8] Event 'logCaptureStarted' logged at 1755758766092 (14:46:06 GMT+0800 (中国标准时间))
[1f2060a7][XCUITestDriver@c6a8] Setting up real device
[1f2060a7][XCUITestDriver@c6a8] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found
[1f2060a7][DevCon Factory] Requesting connection for device 00008140-001E4D940882201C on local port 8100, device port 8100
[1f2060a7][DevCon Factory] Cached connections count: 0
[1f2060a7][DevCon Factory] Successfully requested the connection for 00008140-001E4D940882201C:8100
[1f2060a7][XCUITestDriver@c6a8] Starting WebDriverAgent initialization with the synchronization key 'XCUITestDriver'
[1f2060a7][WD Proxy] NoSessionProxy options: {"server":"127.0.0.1","port":"8100","base":"","timeout":3000,"scheme":"http","reqBasePath":"","sessionId":null}
[1f2060a7][WD Proxy] Matched '/status' to command name 'getStatus'
[1f2060a7][WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[1f2060a7][XCUITestDriver@c6a8] Parsed BUILD_DIR configuration value: '/Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/build'
[1f2060a7][XCUITestDriver@c6a8] Got derived data root: '/Users/jingyi/.appium/node_modules/appium-xcuitest-driver/node_modules'
[1f2060a7][WD Proxy] Got response with status 200: {"value":{"build":{"version":"10.0.0","time":"Aug 21 2025 14:42:17","productBundleIdentifier":"com.facebook.WebDriverAgentRunner"},"os":{"testmanagerdVersion":65535,"name":"iOS","sdkVersion":"18.4","version":"18.0.1"},"device":"iphone","ios":{"ip":"192.168.1.113"},"message":"WebDriverAgent is ready to accept commands","state":"success","ready":true},"sessionId":null}
[1f2060a7][XCUITestDriver@c6a8] Upgrade timestamp of the currently bundled WDA: 1755065907891
[1f2060a7][XCUITestDriver@c6a8] Upgrade timestamp of the WDA on the device: undefined
[1f2060a7][XCUITestDriver@c6a8] Will reuse previously cached WDA instance at 'http://127.0.0.1:8100/' with 'com.facebook.WebDriverAgentRunner'. Set the wdaLocalPort capability to a value different from 8100 if this is an undesired behavior.
[1f2060a7][XCUITestDriver@c6a8] Trying to start WebDriverAgent 1 times with 10000ms interval
[1f2060a7][XCUITestDriver@c6a8] These values can be customized by changing wdaStartupRetries/wdaStartupRetryInterval capabilities
[1f2060a7][XCUITestDriver@c6a8] Event 'wdaStartAttempted' logged at 1755758766607 (14:46:06 GMT+0800 (中国标准时间))
[1f2060a7][XCUITestDriver@c6a8] Using provided WebdriverAgent at 'http://127.0.0.1:8100/'
[1f2060a7][XCUITestDriver@c6a8] JWProxy options: {"scheme":"http","server":"127.0.0.1","port":8100,"base":"","timeout":240000,"keepAlive":true,"reqBasePath":"","sessionId":null}
[1f2060a7][XCUITestDriver@c6a8] NoSessionProxy options: {"scheme":"http","server":"127.0.0.1","port":8100,"base":"","timeout":240000,"keepAlive":true,"reqBasePath":"","sessionId":null}
[1f2060a7][WD Proxy] NoSessionProxy options: {"server":"127.0.0.1","port":"8100","base":"","timeout":3000,"scheme":"http","reqBasePath":"","sessionId":null}
[1f2060a7][WD Proxy] Matched '/status' to command name 'getStatus'
[1f2060a7][WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[1f2060a7][WD Proxy] Got response with status 200: {"value":{"build":{"version":"10.0.0","time":"Aug 21 2025 14:42:17","productBundleIdentifier":"com.facebook.WebDriverAgentRunner"},"os":{"testmanagerdVersion":65535,"name":"iOS","sdkVersion":"18.4","version":"18.0.1"},"device":"iphone","ios":{"ip":"192.168.1.113"},"message":"WebDriverAgent is ready to accept commands","state":"success","ready":true},"sessionId":null}
[1f2060a7][XCUITestDriver@c6a8] Event 'wdaSessionAttempted' logged at 1755758766715 (14:46:06 GMT+0800 (中国标准时间))
[1f2060a7][XCUITestDriver@c6a8] Sending createSession command to WDA
[1f2060a7][XCUITestDriver@c6a8] Matched '/session' to command name 'createSession'
[1f2060a7][XCUITestDriver@c6a8] Proxying [POST /session] to [POST http://127.0.0.1:8100/session] with body: {"capabilities":{"firstMatch":[{"arguments":[],"environment":{},"eventloopIdleDelaySec":0,"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true,"shouldTerminateApp":true,"forceAppLaunch":true,"useNativeCachingStrategy":true,"forceSimulatorSoftwareKeyboardPresence":true}],"alwaysMatch":{}}}
[1f2060a7][XCUITestDriver@c6a8] Got response with status 200: {"value":{"sessionId":"12EE27BE-60FE-49B6-AA99-00D2835F7DEA","capabilities":{"sdkVersion":"18.0.1","device":"iphone"}},"sessionId":"12EE27BE-60FE-49B6-AA99-00D2835F7DEA"}
[1f2060a7][XCUITestDriver@c6a8] Determined the downstream protocol as 'W3C'
[1f2060a7][XCUITestDriver@c6a8] WDA session startup took 163ms
[1f2060a7][XCUITestDriver@c6a8] Event 'wdaSessionStarted' logged at 1755758766878 (14:46:06 GMT+0800 (中国标准时间))
[1f2060a7][XCUITestDriver@c6a8] WebDriverAgent version: '10.0.0'
[1f2060a7][XCUITestDriver@c6a8] Event 'wdaStarted' logged at 1755758766878 (14:46:06 GMT+0800 (中国标准时间))
[1f2060a7][BaseDriver] The value of 'elementResponseAttributes' setting did not change. Skipping the update for it
[1f2060a7][BaseDriver] The value of 'shouldUseCompactResponses' setting did not change. Skipping the update for it
[1f2060a7][XCUITestDriver@c6a8] Forwarding MJPEG server port 9100 to local port 9100
[1f2060a7][DevCon Factory] Requesting connection for device 00008140-001E4D940882201C on local port 9100, device port 9100
[1f2060a7][DevCon Factory] Cached connections count: 1
[1f2060a7][DevCon Factory] Successfully requested the connection for 00008140-001E4D940882201C:9100
[1f2060a7][AppiumDriver@fd5d] New XCUITestDriver session created successfully, session 1f2060a7-14ff-4760-8f9d-418b8a849799 added to master session list
[1f2060a7][AppiumDriver@fd5d] Event 'newSessionStarted' logged at 1755758766884 (14:46:06 GMT+0800 (中国标准时间))
[1f2060a7][XCUITestDriver@c6a8] Cached the protocol value 'W3C' for the new session 1f2060a7-14ff-4760-8f9d-418b8a849799
[1f2060a7][XCUITestDriver@c6a8] Responding to client with driver.createSession() result: {"capabilities":{"webStorageEnabled":false,"locationContextEnabled":false,"browserName":"","platform":"MAC","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true,"networkConnectionEnabled":false,"platformName":"iOS","automationName":"XCUITest","platformVersion":"18.0","deviceName":"yuxizhen’s iPhone","udid":"00008140-001E4D940882201C","showXcodeLog":true}}
[1f2060a7][HTTP] <-- POST /session 200 1328 ms - 439
[1f2060a7][HTTP] --> GET /session/1f2060a7-14ff-4760-8f9d-418b8a849799/window/rect {}
[1f2060a7][XCUITestDriver@c6a8] Calling AppiumDriver.getWindowRect() with args: ["1f2060a7-14ff-4760-8f9d-418b8a849799"]
[1f2060a7][XCUITestDriver@c6a8] Executing command 'getWindowRect'
[1f2060a7][XCUITestDriver@c6a8] Matched '/window/rect' to command name 'getWindowRect'
[1f2060a7][XCUITestDriver@c6a8] Proxying [GET /window/rect] to [GET http://127.0.0.1:8100/session/12EE27BE-60FE-49B6-AA99-00D2835F7DEA/window/rect] with no body
[1f2060a7][XCUITestDriver@c6a8] Got response with status 200: {"value":{"y":0,"x":0,"width":402,"height":874},"sessionId":"12EE27BE-60FE-49B6-AA99-00D2835F7DEA"}
[1f2060a7][XCUITestDriver@c6a8] Responding to client with driver.getWindowRect() result: {"y":0,"x":0,"width":402,"height":874}
[1f2060a7][HTTP] <-- GET /session/1f2060a7-14ff-4760-8f9d-418b8a849799/window/rect 200 505 ms - 48
[1f2060a7][HTTP] --> DELETE /session/1f2060a7-14ff-4760-8f9d-418b8a849799 {}
[1f2060a7][XCUITestDriver@c6a8] Calling AppiumDriver.deleteSession() with args: ["1f2060a7-14ff-4760-8f9d-418b8a849799"]
[1f2060a7][AppiumDriver@fd5d] Event 'quitSessionRequested' logged at 1755758767400 (14:46:07 GMT+0800 (中国标准时间))
[1f2060a7][AppiumDriver@fd5d] Removing session 1f2060a7-14ff-4760-8f9d-418b8a849799 from our master session list
[1f2060a7][XCUITestDriver@c6a8] Proxying [DELETE /session/1f2060a7-14ff-4760-8f9d-418b8a849799] to [DELETE http://127.0.0.1:8100/session/12EE27BE-60FE-49B6-AA99-00D2835F7DEA] with no body
[1f2060a7][XCUITestDriver@c6a8] Got response with status 200: {"value":null,"sessionId":null}
[1f2060a7][DevCon Factory] Releasing connections for 00008140-001E4D940882201C device on any port number
[1f2060a7][DevCon Factory] Found cached connections to release: ["00008140-001E4D940882201C:8100","00008140-001E4D940882201C:9100"]
[1f2060a7][DevCon Factory] Releasing the listener for '00008140-001E4D940882201C:8100'
[1f2060a7][iProxy@00008140:8100] Closing the connection
[1f2060a7][DevCon Factory] Releasing the listener for '00008140-001E4D940882201C:9100'
[1f2060a7][iProxy@00008140:9100] Closing the connection
[1f2060a7][DevCon Factory] Cached connections count: 0
[1f2060a7][XCUITestDriver@c6a8] Not clearing log files. Use clearSystemFiles capability to turn on.
[1f2060a7][iProxy@00008140:9100] The connection has been closed
[1f2060a7][AppiumDriver@fd5d] Event 'quitSessionFinished' logged at 1755758767546 (14:46:07 GMT+0800 (中国标准时间))
[1f2060a7][AppiumDriver@fd5d] Received response: null
[1f2060a7][AppiumDriver@fd5d] But deleting session, so not returning
[1f2060a7][AppiumDriver@fd5d] Responding to client with driver.deleteSession() result: null
[1f2060a7][HTTP] <-- DELETE /session/1f2060a7-14ff-4760-8f9d-418b8a849799 200 148 ms - 14
[1f2060a7][iProxy@00008140:8100] The connection has been closed

暫無回覆。
需要 登录 後方可回應,如果你還沒有帳號按這裡 注册