最近研究 Mac OS 下从命令行启动 Appium 的研究,连接模拟器都没有问题,但是连接真机却出现异常:“Could not initialize ideviceinstaller; make sure it is installed and works on your system”。
Appium GUI 启动连接真机无问题,直接终端启动 appium 再去连接真机也没有问题。
环境信息如下:
Appium1.4.8.dmg
Xcode 6.3
idevice 系列的组件都存在且 appium 下的 idevice 系列组件也是 OK 的。
java 代码片段如下:
String processName = "/Applications/Appium.app/Contents/Resources/node/bin/node "
+ "/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/server/main.js"
+ " --address \"127.0.0.1\" --command-timeout \"15000\" --log-no-colors --debug-log-spacing"
+ " --platform-version \"8.1.3\" --platform-name \"iOS\""
+ " --app \"/Users/user/Documents/TestApp.app\" --log \"/Users/systest/Desktop/appium.log\""
+ " --udid \"f1c019a675bade1fe48837ecda0899d682x280ef\" --no-reset --device-name \"iPad Air 2\"";
String[] CMDS = new String[3];
CMDS[0] = "/bin/bash";
CMDS[1] = "-c";
CMDS[2] = processName;
Runtime rt = Runtime.getRuntime();
try {
rt.exec(CMDS);
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
desiredCapabilities 的内容如下。
capacitymap.put("platformName", "iOS");
capacitymap.put("platformVersion", "8.1.3");
capacitymap.put("newCommandTimeout", 72000);
capacitymap.put("automationName", "Appium");
capacitymap.put("deviceName", "iPad Air 2");
desiredcapmap.put("desiredCapabilities", capacitymap);
Appium GUI 运行关键日志:
2015-08-17 02:59:12:070 - info: [debug] Creating instruments
2015-08-17 02:59:12:071 - info: [debug] Preparing uiauto bootstrap
2015-08-17 02:59:12:071 - info: [debug] Dynamic bootstrap dir: /Users/user/Library/Application Support/appium/bootstrap
2015-08-17 02:59:12:080 - info: [debug] Dynamic env: {"nodePath":"/Applications/Appium.app/Contents/Resources/node/bin/node","commandProxyClientPath":"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js","instrumentsSock":"/tmp/instruments_sock","interKeyDelay":null,"justLoopInfinitely":false,"autoAcceptAlerts":false,"autoDismissAlerts":false,"sendKeyStrategy":"grouped"}
2015-08-17 02:59:12:105 - info: [debug] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!
2015-08-17 02:59:12:105 - info: [debug] Dynamic bootstrap path: /Users/user/Library/Application Support/appium/bootstrap/bootstrap-6745615c424bb0c0.js
2015-08-17 02:59:12:110 - info: [debug] Reusing dynamic bootstrap: /Users/user/Library/Application Support/appium/bootstrap/bootstrap-6745615c424bb0c0.js
2015-08-17 02:59:12:112 - info: [debug] Attempting iOS device log capture via libimobiledevice idevicesyslog
2015-08-17 02:59:12:221 - info: [debug] Creating iDevice object with udid f1c019a675bade1fe48837ecda0899d682c280ef
2015-08-17 02:59:13:830 - info: [debug] App is installed.
java 调用命令行运行关键日志:
2015-08-17 03:00:17:190 - info: [debug] Creating instruments
2015-08-17 03:00:17:191 - info: [debug] Preparing uiauto bootstrap
2015-08-17 03:00:17:191 - info: [debug] Dynamic bootstrap dir: /Users/user/Li
brary/Application Support/appium/bootstrap
2015-08-17 03:00:17:191 - info: [debug] Dynamic env: {"nodePath":"/Applications/Appium.app/Contents/Resources/node/bin/node","commandProxyClientPath":"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js","instrumentsSock":"/tmp/instruments_sock","interKeyDelay":null,"justLoopInfinitely":false,"autoAcceptAlerts":false,"autoDismissAlerts":false,"sendKeyStrategy":"grouped"}
2015-08-17 03:00:17:221 - info: [debug] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!
2015-08-17 03:00:17:221 - info: [debug] Dynamic bootstrap path: /Users/user/Library/Application Support/appium/bootstrap/bootstrap-6745615c424bb0c0.js
2015-08-17 03:00:17:233 - info: [debug] Reusing dynamic bootstrap: /Users/user/Library/Application Support/appium/bootstrap/bootstrap-6745615c424bb0c0.js
2015-08-17 03:00:17:234 - info: [debug] Attempting iOS device log capture via li
bimobiledevice idevicesyslog
2015-08-17 03:00:17:235 - warn: Could not capture device log using libimobiledevice idevicesyslog. Libimobiledevice probably isn't installed
2015-08-17 03:00:17:236 - info: [debug] Attempting iOS device log capture via deviceconsole
2015-08-17 03:00:18:387 - info: [debug] Creating iDevice object with udid f1c019a675bade1fe48837ecda0899d682c280ef
2015-08-17 03:00:18:388 - info: [debug] Couldn't find ideviceinstaller, trying built-in at /Applications/Appium.app/Contents/Resources/node_modules/appium/build/libimobiledevice-macosx/ideviceinstaller
2015-08-17 03:00:18:389 - error: Could not initialize ideviceinstaller; make sure it is installed and works on your system
2015-08-17 03:00:18:389 - info: [debug] Cleaning up appium session
2015-08-17 03:00:18:390 - error: Failed to start an Appium session, err was: Error: Could not initialize ideviceinstaller; make sure it is installed and works on your system
2015-08-17 03:00:18:394 - info: [debug] Error: Could not initialize ideviceinstaller; make sure it is installed and works on your system
at [object Object].IOS.getIDeviceObj (/Applications/Appium.app/Contents/Reso
urces/node_modules/appium/lib/devices/ios/ios.js:909:13)
at [object Object].IOS.installToRealDevice (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/ios/ios.js:856:32)
at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:607:21
at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:246:17
at iterate (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:146:13)
at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:157:25
at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:248:21
at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/async/lib/async.js:612:34
at [object Object].<anonymous> (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/ios/ios-crash-log.js:52:5)
at [object Object].<anonymous> (/Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/ios/ios-crash-log.js:27:5)
at f (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/glob/node_modules/once/once.js:17:25)
at Glob.<anonymous> (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/glob/glob.js:131:7)
at Glob.emit (events.js:107:17)
at Glob._finish (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/glob/glob.js:168:8)
at done (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/glob/glob.js:157:12)
at Glob._processReaddir2 (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/glob/glob.js:351:12)
at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/glob/glob.js:288:17
at RES (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/glob/node_modules/inflight/inflight.js:23:14)
at f (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/glob/node_modules/once/once.js:17:25)
at Glob._readdirEntries (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/glob/glob.js:480:10)
at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/glob/glob.js:457:12
at FSReqWrap.oncomplete (fs.js:95:15)
2015-08-17 03:00:18:394 - info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Could not initialize ideviceinstaller; make sure it is installed and works on your system)","origValue":"Could not initialize ideviceinstaller; make sure it is installed and works on your system"},"sessionId":null}
2015-08-17 03:00:18:400 - info: <-- POST /wd/hub/session 500 1227.408 ms - 300
2015-08-17 03:00:19:424 - info: --> GET /wd/hub/session/null/source {}
2015-08-17 03:00:19:428 - info: <-- GET /wd/hub/session/null/source 404 3.526 ms - 40