IOS Appium 选择的模拟器 UUID 在我的桌面上不存在
IOS Simulator UUID, chosen by Appium does not exist on my desktop
我正在尝试使用 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] The count of running Simulator UI client instances
is 0
[iOSSim] Booting Simulator with UDID
B068A9B1-62CF-4E28-A9DA-E7C7C8EEF8DC...
[iOSSim] Starting Simulator UI with command: open -Fn
/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app
--args -CurrentDeviceUDID B068A9B1-62CF-4E28-A9DA-E7C7C8EEF8DC -ConnectHardwareKeyboard 1
[iOSSim] Simulator with UDID B068A9B1-62CF-4E28-A9DA-E7C7C8EEF8DC
booted in 67 seconds
根据此日志,UUID 被指定为 B068A9B1-62CF-4E28-A9DA-E7C7C8EEF8DC 。但是,当我输入终端时 window:
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] 应用 'com.****.**********' 已安装。无需重新安装。
但是,当我查看打开的模拟器屏幕时,我根本看不到我的应用程序。
我的问题是:
- Appium 如何决定使用哪个设备? (我尝试提供不同的 phone 模型,但 Appium 出于某种原因坚持选择 iPhone X,并且不尊重我的选择。)
- 如果匹配 UUID 的设备不存在,Appium 怎么会认为我的应用已经安装了?
- 如果具有匹配 UUID 的设备没有退出,这个模拟器如何启动?
如有任何见解,我们将不胜感激。谢谢。
事实证明这比我最初想象的要简单。我想分享我在这里的发现,以免其他可能被同样错误困扰的人浪费时间。
当我试图让 Appium 工作时,作为我遇到的障碍之一的解决方案,有人建议使用 sudo 启动 Appium。所以我一直在使用:
sudo ./Appium
开始吧。
这显然是错误的!不要用 sudo 启动 Appium!
如果你不这样做,它就像变魔术一样有效。
从这次经历中吸取的教训:
- 看起来 xcode 对于不同用户的模拟器设备有不同的 UUID。想想就觉得有道理。
- 这也解释了为什么 Appium 没有 select 我作为功能提供的设备。
- 计算机世界没有魔法。只是有误会。
我正在尝试使用 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] The count of running Simulator UI client instances is 0
[iOSSim] Booting Simulator with UDID B068A9B1-62CF-4E28-A9DA-E7C7C8EEF8DC...
[iOSSim] Starting Simulator UI with command: open -Fn /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app --args -CurrentDeviceUDID B068A9B1-62CF-4E28-A9DA-E7C7C8EEF8DC -ConnectHardwareKeyboard 1
[iOSSim] Simulator with UDID B068A9B1-62CF-4E28-A9DA-E7C7C8EEF8DC booted in 67 seconds
根据此日志,UUID 被指定为 B068A9B1-62CF-4E28-A9DA-E7C7C8EEF8DC 。但是,当我输入终端时 window:
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] 应用 'com.****.**********' 已安装。无需重新安装。
但是,当我查看打开的模拟器屏幕时,我根本看不到我的应用程序。
我的问题是:
- Appium 如何决定使用哪个设备? (我尝试提供不同的 phone 模型,但 Appium 出于某种原因坚持选择 iPhone X,并且不尊重我的选择。)
- 如果匹配 UUID 的设备不存在,Appium 怎么会认为我的应用已经安装了?
- 如果具有匹配 UUID 的设备没有退出,这个模拟器如何启动?
如有任何见解,我们将不胜感激。谢谢。
事实证明这比我最初想象的要简单。我想分享我在这里的发现,以免其他可能被同样错误困扰的人浪费时间。
当我试图让 Appium 工作时,作为我遇到的障碍之一的解决方案,有人建议使用 sudo 启动 Appium。所以我一直在使用:
sudo ./Appium
开始吧。
这显然是错误的!不要用 sudo 启动 Appium!
如果你不这样做,它就像变魔术一样有效。
从这次经历中吸取的教训:
- 看起来 xcode 对于不同用户的模拟器设备有不同的 UUID。想想就觉得有道理。
- 这也解释了为什么 Appium 没有 select 我作为功能提供的设备。
- 计算机世界没有魔法。只是有误会。