Appium错误:无法创建新会话。 (原始错误:' java -version'失败。错误:产生ENOENT)

时间:2015-11-13 18:57:33

标签: java eclipse testing junit appium

eclipse的代码: 公共类所需能力{

    @Test
    public void test() throws IOException {
    File appDir = new File("src");
    File app = new File(appDir,"bookMyShow-ucb.apk");

    DesiredCapabilities cap = new DesiredCapabilities();
    cap.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);
    cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
    //cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
    cap.setCapability(MobileCapabilityType.APP, app.getCanonicalPath());
    AndroidDriver Driver = new AndroidDriver(new URL("http://127.0.0.1:4724/wd/hub"),cap);


    }

}

Appium日志:

  

使用以下命令启动Appium服务器:C:\ Program Files(x86)\ Appium \ node.exe lib \ server \ main.js --address 127.0.0.1 --port 4724 --session-override --platform-name Android --platform-version 23 --automation-name Appium --log-no-color   警告:Appium支持节点版本< 0.12已被弃用,将来的版本将被删除。请升级!   信息:欢迎来到Appium v​​1.4.13(REV c75d8adcb66a75818a542fe1891a34260c21f76a)   info:Appium REST http接口监听器在127.0.0.1:4724上启动   info:[debug]非默认服务器参数:{"地址":" 127.0.0.1","端口":4724," sessionOverride&# 34;:真," logNoColors":真," platformName":" Android和#34;" platformVersion":" 23&#34 ;," automationName":" Appium"}   info:Console LogLevel:debug   信息: - > POST / wd / hub / session {" desiredCapabilities":{" app":" C:\ Users \ sahil \ workspace \ intro \ src \ bookMyShow-ucb.apk&# 34;," platformName":" Android"," deviceName":" Android模拟器"}}   info:客户端用户代理字符串:Apache-HttpClient / 4.5.1(Java / 1.7.0_79)   info:[debug]没有appActivity所需的功能或服务器参数。从apk解析。   info:[debug]没有appPackage所需的功能或服务器参数。从apk解析。   info:[debug]使用所需大写的本地应用程序:C:\ Users \ sahil \ workspace \ intro \ src \ bookMyShow-ucb.apk   info:[debug]创建新的appium会话16b1787e-64bd-4bc5-b009-a0a518730ae0   错误:无法启动Appium会话,错误是:错误:' java -version'失败。错误:产生ENOENT   info:启动android appium   info:[debug]获取Java版本   info:[debug]清理android对象   info:[debug]清理appium会话   info:[debug]错误:' java -version'失败。错误:产生ENOENT       在[object Object]。 (C:\ Program Files(x86)\ Appium \ node_modules \ appium \ lib \ devices \ android \ android-common.js:1057:17)       在exithandler(child_process.js:633:7)       在ChildProcess.errorhandler(child_process.js:649:5)       在ChildProcess.EventEmitter.emit(events.js:95:17)       在Process.ChildProcess._handle.onexit(child_process.js:795:12)   info:[debug]响应客户错误:{" status":33," value":{" message":"新会话可以不被创造。 (原始错误:' java -version'失败。错误:产生ENOENT)"," origValue":"' java -version'失败。错误:产生ENOENT"}," sessionId":null}   info:< - POST / wd / hub / session 500 181.826 ms - 208

2 个答案:

答案 0 :(得分:0)

看起来您的节点版本低于Appium 1.4.13所需的版本。

automation-name Appium --log-no-color warn: Appium support for     versions of node < 0.12

检查您的节点版本:

node --version v0.12.4

答案 1 :(得分:0)

升级您的节点点击here 应该工作