Appium 在 iPhone 模拟器上启动失败,在设备上成功

Appium fails launching on iPhone Simulator, success on device

我能够 运行 在 iPhone 设备上成功进行测试,但在 iPhone 模拟器上无法成功。

错误:

[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[HTTP] --> GET /status
[HTTP] {}
[debug] [HTTP] No route found. Setting content type to 'text/plain'
[HTTP] <-- GET /status 404 1 ms - 49
[HTTP] 
[WD Proxy] Got an unexpected response with status 404: The URL '/status' did not map to a valid resource

这是 Appium 服务器的详细信息:

Welcome to Appium v1.15.1
[Appium] Non-default server args:
[Appium]   address: 127.0.0.1
[Appium]   port: 8100
[Appium] Appium REST http interface listener started on 127.0.0.1:8100

能力(Python):

def setUp(self):

        app = ('/Users/...app')
        self.driver = webdriver.Remote(
            command_executor='http://127.0.0.1:8100/wd/hub',
            desired_capabilities={
                'app': app,
                'platformName': 'iOS',
                'platformVersion': '13.1',
                'deviceName': 'iPhone Simulator',
                "automationName": "XCUITest",
                "xcodeOrgId": "XXXXXXXX",
                "xcodeSigningId": "iPhone Developer"
            }
        )

有什么建议吗?

"deviceName"、"platformVersion" capability 应等于设备模拟器名称。

像这样,

capabilities.setCapability("deviceName", "iPhone 8 Plus");
capabilities.setCapability("platformVersion", "12.2");
capabilities.setCapability("automationName": "XCUITest");

P.S - iPhone X,XS 不适合我 [因为 'X' 我猜!]

尝试使用以下功能:

desired_capabilities={
            'app': app,
            'platformName': 'iOS',
            'platformVersion': '13.1',
            'deviceName': 'iPhone Simulator',
            'udid': 'unique id of simulator',
            "automationName": "XCUITest"              
        }

udid可以在Simulator>Hardware>Device>Manage Deviceselect设备中找到,然后就可以看到Identifier

端口需要为 4723。