违规处理区 mac 通过 java 启动 appium 服务在创建 driver 的时候报错,服务端提示未安装 idevice_id,但实际已经安装

小胖。 · May 06, 2017 · Last by 陈恒捷 replied at May 08, 2017 · Last modified by admin 陈恒捷 · 1014 hits

问题:

mac 通过java启动appium服务在创建driver的时候报错,服务端提示未安装idevice_id,但实际已经安装。

####启动服务代码:
public static String iosWriteFile="/Users/globalegrow2017/Desktop/autowork/aa.txt";
public static String nodePlace="/usr/local/bin/node";
public static String appiumPlace="/usr/local/bin/appium";
appiumServerUrl = "http://localhost:+port+/wd/hub"";
freeDeviceName=udid;
Log.logInfo(udid);
Log.logInfo("run " + udid + " Appium Server in port " + port + "...");
//多设备server端需要手动指定每台设备的udid,安卓无线连接下就是设备的ip:port..
String Command = nodePlace+" "+appiumPlace+" -p " + port + " >" +iosWriteFile;
Log.logInfo("启动appium命令:"+Command);
try {
String[] cmd = {"/bin/bash", "-c", Command};
//执行Shell命令
Runtime.getRuntime().exec(cmd);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

Log.logInfo("开始启动appium,端口:"+port+"·············");
Page.pause(20);
int timeout = 0;
OK:
while (true) {
if(timeout > 20){
Log.logInfo("启动appium超时,60秒未启动成功··········");
break;
}
try{
timeout++;
JSONObject res= JSONObject.fromObject(Pub.get("http://127.0.0.1:+port+/wd/hub/status).get(Response)");
if (res!=null) {
Log.logInfo("appium启动成功,端口号为:"+port);
break OK;
}
Page.pause(2);

}catch (Exception e) {
// TODO: handle exception
}

}
Page.pause(5);

}

创建driver代码:

capabilities.setCapability("platformName", platformName);

capabilities.setCapability("udid",udid);//真机
capabilities.setCapability("deviceName",deviceName);//真机
capabilities.setCapability("platformVersion", platformVersion);// 版本
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("newCommandTimeout", newCommandTimeout);
capabilities.setCapability("webDriverAgentUrl", "http://localhost:8100");
capabilities.setCapability("noReset", true); //不重新安装App
Log.logInfo("capabilities信息:"+capabilities.toString());
try {
Log.logInfo("开始启动session··············");
appiumServerUrl="http://localhost:4723/wd/hub";
driver = new IOSDriver(new URL(appiumServerUrl), capabilities);

Log.logInfo("启动session成功··············");
} catch (Exception e) {
e.printStackTrace();
Log.logInfo("启动session异常:"+e.getMessage());
}
Page.pause(4);

服务器日志:

The 'idevice_id' program is not installed. If you are running a real device test it is necessary. Install with 'brew install libimobiledevice --HEAD'
但其实已经装了。。

其他信息:

idevice_id -l: 91a567fc5875c36dbe791a1d871fd9f328040841
appium: 1.6.4

备注:如果手动通过命令行或则客户端启动服务,然后再用代码创建driver是可以的;主要就是想通过代码去启动服务和driver,而不是每次手动启动服务。

此贴已暂时被屏蔽!

以下几种情况的帖子可能会进入此节点:

  1. 不使用 markdown 写作 : https://testerhome.com/markdown
  2. 标题/正文描述不清不楚;
  3. 无意义的发帖;
  4. 存在广告嫌疑;
  5. 招聘信息描述不清楚,未按照招聘节点的要求发帖,或职位信息不符合社区 用户群需求;
  6. 新注册的帐号发布产品推广贴是不允许的哦,付出和回报是相等的,当然如果你的产品确实非常有意思,或是和测试有关的东西,是不会进入这个栏目的。

如果你发现你的帖子到了此节点下面,请自我检查反省,并修改帖子内容。

新人请阅读:https://testerhome.com/topics/982
学会如何合理提问,请阅读:https://testerhome.com/topics/587

当你修改好以后,可以回帖 @屏蔽你的同学 ,我们将会审核,通过以后才可恢复到其他节点。

注!多次发现广告嫌疑的帐号,将会被禁用帐号。

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
共收到 2 条回复 时间 点赞
小胖。 #1 · May 06, 2017 作者

服务器日志:
[Appium] Welcome to Appium v1.6.4
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> GET /wd/hub/status {}
[debug] [MJSONWP] Calling AppiumDriver.getStatus() with args: []
[debug] [MJSONWP] Responding to client with driver.getStatus() result: {"build":{"version":"1.6.4","revision":null}}
[HTTP] <-- GET /wd/hub/status 200 22 ms - 83
[HTTP] --> POST /wd/hub/session {"capabilities":{"desiredCapabilities":{"app":"/Users/globalegrow2017/Desktop/autowork/gearbestAndroid/apps/Gearbest.ipa","noReset":true,"newCommandTimeout":"300","platformVersion":"10.2","automationName":"XCUITest","platformName":"iOS","udid":"91a567fc5875c36dbe791a1d871fd9f328040841","deviceName":"iPhone","webDriverAgentUrl":"http://localhost:8100,"requiredCapabilities":{}},"desiredCapabilities":{"app":"/Users/globalegrow2017/Desktop/autowork/gearbestAndroid/apps/Gearbest.ipa","noReset":true,"newCommandTimeout":"300","platformVersion":"10.2","automationName":"XCUITest","platformName":"iOS","udid":"91a567fc5875c36dbe791a1d871fd9f328040841","deviceName":"iPhone","webDriverAgentUrl":"http://localhost:8100,"requiredCapabilities":{}"}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"/Users/globalegrow2017/Desktop/autowork/gearbestAndroid/apps/Gearbest.ipa","noReset":true,"newCommandTimeout":"300","platformVersion":"10.2","automationName":"XCUITest","platformName":"iOS","udid":"91a567fc5875c36dbe791a1d871fd9f328040841","deviceName":"iPhone","webDriverAgentUrl":"http://localhost:8100,{},{"desiredCapabilities":{"app":"/Users/globalegrow2017/Desktop/autowork/gearbestAndroid/apps/Gearbest.ipa","noReset":true,"newCommandTimeout":"300","platformVersion":"10.2","automationName":"XCUITest","platformName":"iOS","udid":"91a567fc5875c36dbe791a1d871fd9f328040841","deviceName":"iPhone","webDriverAgentUrl":"http://localhost:8100,"requiredCapabilities":{}}"}]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1494033351556 (09:15:51 GMT+0800 (CST))
[Appium] Creating new XCUITestDriver (v2.28.2) session
[Appium] Capabilities:
[Appium] app: '/Users/globalegrow2017/Desktop/autowork/gearbestAndroid/apps/Gearbest.ipa'
[Appium] noReset: true
[Appium] newCommandTimeout: '300'
[Appium] platformVersion: '10.2'
[Appium] automationName: 'XCUITest'
[Appium] platformName: 'iOS'
[Appium] udid: '91a567fc5875c36dbe791a1d871fd9f328040841'
[Appium] deviceName: 'iPhone'
[Appium] webDriverAgentUrl: 'http://localhost:8100'
[debug] [XCUITest] XCUITestDriver version: 2.28.2
[BaseDriver] Capability 'newCommandTimeout' changed from string ('300') to integer (300). This may cause unexpected behavior
[BaseDriver] Session created with session id: f3b9ede3-129a-4a88-995a-7671f1c7b16a
[debug] [XCUITest] Xcode version set to '8.3.1' (tools v8.3.2.0.1.1492020469)
[debug] [XCUITest] iOS SDK Version set to '10.3'
[debug] [BaseDriver] Event 'xcodeDetailsRetrieved' logged at 1494033351694 (09:15:51 GMT+0800 (CST))
[XCUITest] The 'idevice_id' program is not installed. If you are running a real device test it is necessary. Install with 'brew install libimobiledevice --HEAD'
[debug] [XCUITest] Available devices:
[debug] [XCUITest] Not clearing log files. Use clearSystemFiles capability to turn on.
[HTTP] <-- POST /wd/hub/session 500 276 ms - 213
[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"app":"/Users/globalegrow2017/Desktop/autowork/gearbestAndroid/apps/Gearbest.ipa","noReset":true,"newCommandTimeout":"300","platformVersion":"10.2","automationName":"XCUITest","platformName":"iOS","udid":"91a567fc5875c36dbe791a1d871fd9f328040841","deviceName":"iPhone","webDriverAgentUrl":"http://localhost:8100,"requiredCapabilities":{}"}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"/Users/globalegrow2017/Desktop/autowork/gearbestAndroid/apps/Gearbest.ipa","noReset":true,"newCommandTimeout":"300","platformVersion":"10.2","automationName":"XCUITest","platformName":"iOS","udid":"91a567fc5875c36dbe791a1d871fd9f328040841","deviceName":"iPhone","webDriverAgentUrl":"http://localhost:8100,{},null"}]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1494033351852 (09:15:51 GMT+0800 (CST))
[Appium] Creating new XCUITestDriver (v2.28.2) session
[Appium] Capabilities:
[Appium] app: '/Users/globalegrow2017/Desktop/autowork/gearbestAndroid/apps/Gearbest.ipa'
[Appium] noReset: true
[Appium] newCommandTimeout: '300'
[Appium] platformVersion: '10.2'
[Appium] automationName: 'XCUITest'
[Appium] platformName: 'iOS'
[Appium] udid: '91a567fc5875c36dbe791a1d871fd9f328040841'
[Appium] deviceName: 'iPhone'
[Appium] webDriverAgentUrl: 'http://localhost:8100'
[debug] [XCUITest] XCUITestDriver version: 2.28.2
[BaseDriver] Capability 'newCommandTimeout' changed from string ('300') to integer (300). This may cause unexpected behavior
[BaseDriver] Session created with session id: 261a6527-e2d4-48e6-9ab8-b53e833ccf5f
[debug] [XCUITest] Xcode version set to '8.3.1' (tools v8.3.2.0.1.1492020469)
[debug] [XCUITest] iOS SDK Version set to '10.3'
[debug] [BaseDriver] Event 'xcodeDetailsRetrieved' logged at 1494033351887 (09:15:51 GMT+0800 (CST))
[XCUITest] The 'idevice_id' program is not installed. If you are running a real device test it is necessary. Install with 'brew install libimobiledevice --HEAD'
[debug] [XCUITest] Available devices:
[debug] [XCUITest] Not clearing log files. Use clearSystemFiles capability to turn on.
[HTTP] <-- POST /wd/hub/session 500 124 ms - 213
[HTTP] --> POST /wd/hub/session {"capabilities":{"desiredCapabilities":{"app":"/Users/globalegrow2017/Desktop/autowork/gearbestAndroid/apps/Gearbest.ipa","noReset":true,"newCommandTimeout":"300","platformVersion":"10.2","automationName":"XCUITest","platformName":"iOS","udid":"91a567fc5875c36dbe791a1d871fd9f328040841","deviceName":"iPhone","webDriverAgentUrl":"http://localhost:8100,"requiredCapabilities":{}}"}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [null,null,{"desiredCapabilities":{"app":"/Users/globalegrow2017/Desktop/autowork/gearbestAndroid/apps/Gearbest.ipa","noReset":true,"newCommandTimeout":"300","platformVersion":"10.2","automationName":"XCUITest","platformName":"iOS","udid":"91a567fc5875c36dbe791a1d871fd9f328040841","deviceName":"iPhone","webDriverAgentUrl":"http://localhost:8100,"requiredCapabilities":{}}"}]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1494033351982 (09:15:51 GMT+0800 (CST))
[HTTP] <-- POST /wd/hub/session 500 19 ms - 179

学习下怎么用 markdown 语法把,骚年。。。现在的排版代码块部分太乱了,所有缩进都没有了。

陈恒捷 屏蔽了此话题:请使用 markdwon 语法排版。 08 May 07:26
小胖。 关闭了讨论 08 May 11:46
需要 Sign In 后方可回复, 如果你还没有账号请点击这里 Sign Up