首页 > 技术文章 > windows 上启动appium

lisawu 2017-01-24 16:11 原文

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();

}

}

 

推荐阅读