无法在MAC OS Sierra上执行测试。以下是环境信息和代码片段。此外,您还可以从appium中找到错误日志。有关为devicename提供哪些信息以及为什么我收到此错误的任何指示都会有所帮助。
连接到机器的设备在xcode中被识别,其名称与代码段中提供的bing相同。
Appium版本:1.6.3 MAC OS版本:10.12.2 XCode版本:8.2
应用程序启动代码:
public class TC_MobileLogin {
public static AppiumDriver wd;
@Test
public void StartLogin() throws IOException {
DesiredCapabilities capability = new DesiredCapabilities();
capability.setCapability(MobileCapabilityType.PLATFORM_NAME,"iOS");
capability.setCapability(MobileCapabilityType.PLATFORM_VERSION,"10.2");
capability.setCapability(MobileCapabilityType.DEVICE_NAME,"iphone");
File app = new File("/Users/samanth/Downloads/myapp.ipa");
capability.setCapability("app", app.getAbsolutePath());
wd = new IOSDriver(new URL("http://0.0.0.0:4723/wd/hub"), capability);
wd.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
}
}
我在Appium收到的错误:
[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"app":"/Users/samanth/Downloads/myapp.ipa","platformName":"iOS","deviceName":"iphone","platformVersion":"10.2"}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"/Users/samanth/Downloads/myapp.ipa","platformName":"iOS","deviceName":"iphone","platformVersion":"10.2"},null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]
[Appium] Requested iOS support with version >= 10, using XCUITest driver instead of UIAutomation-based driver, since the latter is unsupported on iOS 10 and up.
[Appium] Creating new XCUITestDriver session
[Appium] Capabilities:
[Appium] app: '/Users/samanth/Downloads/myapp.ipa'
[Appium] platformName: 'iOS'
[Appium] deviceName: 'iphone'
[Appium] platformVersion: '10.2'
[debug] [XCUITest] XCUITestDriver version: 2.4.2
[BaseDriver] Session created with session id: 42938854-74eb-4c48-97e8-606f88b705b4
[debug] [XCUITest] Xcode version set to '8.2.1'
[debug] [XCUITest] iOS SDK Version set to '10.2'
[XCUITest] Simluator udid not provided, using desired caps to create a new simulator
**[simctl] Error: simctl error running 'create': Invalid device type: iphone**
at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
at simCommand$ (lib/simctl.js:22:11)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
Error: simctl error running 'create': Invalid device type: iphone
at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
at simCommand$ (lib/simctl.js:22:11)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[simctl] Error: simctl error running 'create': Invalid device type: iphone
at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
at simCommand$ (lib/simctl.js:22:11)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
Error: simctl error running 'create': Invalid device type: iphone
at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
at simCommand$ (lib/simctl.js:22:11)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[XCUITest] Error: simctl error running 'create': Invalid device type: iphone
at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
at simCommand$ (lib/simctl.js:22:11)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
Error: simctl error running 'create': Invalid device type: iphone
at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
at simCommand$ (lib/simctl.js:22:11)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[debug] [XCUITest] Running iOS simulator reset flow
[MJSONWP] Encountered internal error running command: Error: simctl error running 'create': Invalid device type: iphone
at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
at simCommand$ (lib/simctl.js:22:11)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[HTTP] <-- POST /wd/hub/session 500 251 ms - 195
答案 0 :(得分:2)
您好,在最新的appium上,您还需要添加udid
capabilities.setCapability(&#34; udid&#34;,&#34; 3 ##########&#34;);