背景

  1. 因 appium 长实际运行会报错,需要在程序中去启动 appium 服务
  2. 报的错误是: org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Could not initialize ideviceinstaller; make sure it is installed and works on your system)
  3. 在 GUI 和终端启动服务都可以正常运行!
  4. 已经试过重装 ideviceinstaller(brew install -HEAD ideviceinstaller)了,还是有问题

此问题已经困扰好久了,希望哪个高人帮忙解答一下,以下是代码:


程序启动 appium 代码 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 \"7200\" --debug-log-spacing"
+ " --platform-version \"9.1\" --platform-name \"iOS\""
+ " --app \"com.letv.store.iphone.client\""
+ " --udid \"9932377fd430f2e2b0e0bcc1da58179d4ff1e4d7\" --device-name \"iPhone 6\"";
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(20000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}catch (ExecuteException e) { // TODO Auto-generated catch block e.printStackTrace(); }


↙↙↙阅读原文可查看相关链接,并与作者交流