windows 上启动appium

import org.apache.commons.exec.CommandLine;

import org.apache.commons.exec.DefaultExecuteResultHandler;

import org.apache.commons.exec.DefaultExecutor;

public void startAppiumOnWindows(String port) {

CommandLine command = new CommandLine("D:/app/appium/Appium/node");

command.addArgument("D:/app/appium/Appium/node_modules/appium/bin/appium.js",false);

command.addArgument("--address", false);

command.addArgument("127.0.0.1");

command.addArgument("--port", false);

command.addArgument(port);

command.addArgument("--full-reset", false);

command.addArgument("--session-override", false);

DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();

DefaultExecutor executor = new DefaultExecutor();

executor.setExitValue(1);

try {

executor.execute(command, resultHandler);

Thread.sleep(5000);

}

catch (IOException e) {

e.printStackTrace();

}

catch (InterruptedException e) {

e.printStackTrace();

}

}

 

posted on 2017-01-24 16:11  Wu0206  阅读(225)  评论(0编辑  收藏  举报

导航