Appium无法在iPhone Simulator上启动,在设备上成功

时间:2019-12-10 12:07:44

标签: ios iphone testing appium simulator

  • Appium v​​1.15.1
  • Mac 10.14.6
  • Xcode 11.2.1
  • Python测试文件。

我可以在iPhone设备上成功运行测试,但不能在iPhone Simulator上运行

错误:

[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"
            }
        )

有什么建议吗?

2 个答案:

答案 0 :(得分:0)

“ deviceName”,“ platformVersion”功能应等于设备模拟器名称。

这样的事情,

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

P.S-iPhone X,XS不适用于我([我猜是因为'X'!)

答案 1 :(得分:0)

尝试使用以下功能:

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

模拟器>硬件>设备>管理设备中可以找到被选中的设备,然后您可以看到标识符。

端口必须为4723。