我正在尝试使用 Appium 对我的 IOS 应用程序进行一些测试。(这是我第一次使用它)。我正在使用 Appium Desktop 启动 Appium。这是我的能力列表:
{
"platformName": "iOS",
"platformVersion": "11.2",
"deviceName": "iPhone 7 Plus",
"automationName": "XCUITest",
"app": "/Users/me/Library/Developer/Xcode/DerivedData/MyApp/Build/Products/Debug-iphoneos/MyApp.app",
"noReset": true,
"showIOSLog": true
}
当我开始一个会话时,在日志中,我看到 Appium 正在使用 UUID B068A9B1-62CF-4E28-A9DA-E7C7C8EEF8DC 启动一个 IOS 模拟器。这是相关的日志行:
[debug] [iOSSim] 运行模拟器 UI 客户端实例数为 0
[iOSSim] 使用 UDID B068A9B1-62CF-4E28-A9DA-E7C7C8EEF8DC 启动模拟器...
[iOSSim] 使用命令启动模拟器 UI:open -Fn /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app --args -CurrentDeviceUDID B068A9B1-62CF-4E28-A9DA-E7C7C8EEF8DC -ConnectHardwareKeyboard 1
[iOSSim] 带有 UDID B068A9B1-62CF-4E28-A9DA-E7C7C8EEF8DC 的模拟器在 67 秒内启动
根据此日志,UUID 为B068A9B1-62CF-4E28-A9DA-E7C7C8EEF8DC。但是,当我在终端窗口中键入时:
xcrun simctl list
我得到的清单如下:
== Devices ==
-- iOS 11.2 --
iPhone 5s (46A12989-6F7E-459D-A566-347883681981) (Shutdown)
iPhone 6 (429F8EB3-E8C6-4EE6-8313-17E6FBE98BB2) (Shutdown)
iPhone 6 Plus (2EB7ADC5-47F7-46DD-92A2-043D8CD36764) (Shutdown)
iPhone 6s (FDE95542-48A8-4C7E-A983-84D0747AF5B6) (Shutdown)
iPhone 6s Plus (25008979-F6E4-42F6-B5A0-28ED4D872E85) (Shutdown)
iPhone 7 (DBD96A0C-B1D7-4FA6-8DE4-CBE741859341) (Shutdown)
iPhone 7 Plus (2D65A1C5-CA42-4808-B60A-C7805DFE0D02) (Shutdown)
iPhone 8 (781339FA-7397-455C-8EB1-5D116381ACD6) (Shutdown)
iPhone 8 Plus (22C4CA50-57CD-4D03-A9DB-5A7E8CED337C) (Shutdown)
iPhone SE (EA7C6EE8-D177-4FA0-AD6C-2AC3FA1ABB74) (Shutdown)
iPhone X (359B77C6-0559-4FF6-83E3-E815A5EBA1C5) (Booted)
iPad Air (3DFF4AE2-3867-4E18-92D6-6086B5909FCC) (Shutdown)
iPad Air 2 (AED4735B-8771-494E-9F80-A2A8F8EE09E8) (Shutdown)
iPad (5th generation) (9094F6EE-4190-4028-9596-EAC994CEC44E) (Shutdown)
iPad Pro (9.7-inch) (59A04DFC-48BC-4302-A824-0F6F2C818650) (Shutdown)
iPad Pro (12.9-inch) (42446801-ED81-4A7E-992B-FC1DB96CCEFA) (Shutdown)
iPad Pro (12.9-inch) (2nd generation) (1C95389C-3508-4998-A770-AC02DE6C6797) (Shutdown)
iPad Pro (10.5-inch) (7FD67BA5-C826-4CB5-BA7B-BB1F1B7B0B0F) (Shutdown)
-- tvOS 11.2 --
Apple TV (AC8B4DA3-286E-4507-8FBB-D358EAC8E607) (Shutdown)
Apple TV 4K (4E8B99D7-D07B-4ECF-8E07-EAD5D799929C) (Shutdown)
Apple TV 4K (at 1080p) (9510E577-B71D-4D24-BA10-0B5E079F4DAB) (Shutdown)
-- watchOS 4.2 --
Apple Watch - 38mm (36E860BC-4DF3-413C-90C4-71FB2813B13D) (Shutdown)
Apple Watch - 42mm (A8408CA5-99C3-4F0E-B571-7509703B2FE0) (Shutdown)
Apple Watch Series 2 - 38mm (19BAAC48-A69C-4D5B-A921-7008C76CA3C5) (Shutdown)
Apple Watch Series 2 - 42mm (0CA6DA87-4BBE-44AF-8B82-C652CA3D80CC) (Shutdown)
Apple Watch Series 3 - 38mm (5515A207-88C3-4752-82A2-E99F5B7C8532) (Shutdown)
Apple Watch Series 3 - 42mm (9532F5BC-DAA0-4CC0-A544-D26A6EC9F9AD) (Shutdown)
== Device Pairs ==
AE5E48FE-EFBD-4FF9-851E-861ED3FF2002 (active, disconnected)
Watch: Apple Watch Series 2 - 38mm (19BAAC48-A69C-4D5B-A921-7008C76CA3C5) (Shutdown)
Phone: iPhone 7 (DBD96A0C-B1D7-4FA6-8DE4-CBE741859341) (Shutdown)
64C97089-7FB9-4CC3-986C-7B3F56D982CC (active, disconnected)
Watch: Apple Watch Series 2 - 42mm (0CA6DA87-4BBE-44AF-8B82-C652CA3D80CC) (Shutdown)
Phone: iPhone 7 Plus (2D65A1C5-CA42-4808-B60A-C7805DFE0D02) (Shutdown)
10141E88-D1D8-4BF7-A665-59A6EB10F8A9 (active, disconnected)
Watch: Apple Watch Series 3 - 38mm (5515A207-88C3-4752-82A2-E99F5B7C8532) (Shutdown)
Phone: iPhone 8 (781339FA-7397-455C-8EB1-5D116381ACD6) (Shutdown)
9ED5EC88-726E-46CE-A7C9-5849613ABAFA (active, disconnected)
Watch: Apple Watch Series 3 - 42mm (9532F5BC-DAA0-4CC0-A544-D26A6EC9F9AD) (Shutdown)
Phone: iPhone 8 Plus (22C4CA50-57CD-4D03-A9DB-5A7E8CED337C) (Shutdown)
如您所见,不存在具有匹配 UUID 的此类设备。
更有趣的是,Appium 认为我的应用程序已经安装到此设备上,在日志中:
[调试] [XCUITest] App 'com.****.**********' 已经安装。无需重新安装。
但是,当我查看打开的模拟器屏幕时,我根本看不到我的应用程序。
我的问题是:
- Appium 如何决定使用哪个设备?(我尝试提供不同的手机型号,但 Appium 出于某种原因坚持选择 iPhone X,不尊重我的选择。)
- 如果不存在具有匹配 UUID 的设备,Appium 怎么会认为我的应用程序已经安装?
- 如果具有匹配 UUID 的设备没有退出,这个模拟器如何启动?
任何见解将不胜感激。谢谢你。