Appium服务器显示“null”无法强制转换为有效的版本号错误。
以下是我使用过的DesiredCapabilities
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(MobileCapabilityType.UDID, udid);
caps.setCapability(MobileCapabilityType.NO_RESET, noReset);
caps.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 600);
caps.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.IOS);
caps.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone");
caps.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
caps.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
caps.setCapability("xcodeOrgId", myXcodeOrgId);
caps.setCapability("xcodeSigningId", "iPhone Developer");
caps.setCapability("showXcodeLog", true);
driver = new IOSDriver(new URL("http://" + host + ":" + port + "/wd/hub"), caps);
以下是appium服务器日志:
Creating session with W3C capabilities: {"alwaysMatch":{"platformNa... [BaseDriver] Session created with session id: 77cbca4b-157d-462e-ab26-5cc9cc47c7a9 [debug] [XCUITest] Current user: 'infotmt' [XCUITest] Error: 'null' cannot be coerced to a valid version number [XCUITest] at coerceVersion (/usr/local/lib/node_modules/appium/node_modules/appium-support/lib/util.js:241:11) [XCUITest] at Object.coerceVersion [as compareVersions] (/usr/local/lib/node_modules/appium/node_modules/appium-support/lib/util.js:268:35) [XCUITest] at XCUITestDriver.compareVersions [as start] (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:263:14) [debug] [XCUITest] Not clearing log files. Use `clearSystemFiles` capability to turn on. [debug] [BaseDriver] Event 'newSessionStarted' logged at 1553847186978 (13:58:06 GMT+0545 (Nepal Time)) [debug] [W3C] Encountered internal error running command: Error: 'null' cannot be coerced to a valid version number [debug] [W3C] at coerceVersion (/usr/local/lib/node_modules/appium/node_modules/appium-support/lib/util.js:241:11) [debug] [W3C] at Object.coerceVersion [as compareVersions] (/usr/local/lib/node_modules/appium/node_modules/appium-support/lib/util.js:268:35) [debug] [W3C] at XCUITestDriver.compareVersions [as start] (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:263:14) [HTTP] <-- POST /wd/hub/session 500 29 ms - 597 [HTTP]
我在用
Appium server version - 1.12.1
Java client Version - 7.0.0
在Appium 1.12.1中,必须设置platformVersion。要添加的代码:
caps.setCapability(“platformVersion”,“12.2”);
12.2是iOS的版本。