本文整理汇总了Java中org.openqa.selenium.os.CommandLine.setEnvironmentVariables方法的典型用法代码示例。如果您正苦于以下问题:Java CommandLine.setEnvironmentVariables方法的具体用法?Java CommandLine.setEnvironmentVariables怎么用?Java CommandLine.setEnvironmentVariables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openqa.selenium.os.CommandLine
的用法示例。
在下文中一共展示了CommandLine.setEnvironmentVariables方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import org.openqa.selenium.os.CommandLine; //导入方法依赖的package包/类
/**
* 启动appium服务端
*
*
* @throws AppiumServerHasNotBeenStartedLocallyException
* 如果在产生子进程中发生错误,则抛此异常
*
* @see #stop()
*/
public void start() throws AppiumServerHasNotBeenStartedLocallyException {
lock.lock();
try {
if (isRunning()) {
return;
}
try {
process = new CommandLine(this.nodeJSExec.getCanonicalPath(),
nodeJSArgs.toArray(new String[] {}));
process.setEnvironmentVariables(nodeJSEnvironment);
process.copyOutputTo(stream);
process.executeAsync();
ping(startupTimeout, timeUnit);
} catch (Throwable e) {
destroyProcess();
String msgTxt = "本地appium服务尚未启动. "
+ "Node.js路径: " + this.nodeJSExec.getAbsolutePath()
+ " 参数: " + nodeJSArgs.toString() + " " + "\n";
if (process != null) {
String processStream = process.getStdOut();
if (!StringUtils.isBlank(processStream)) {
msgTxt = msgTxt + "Process output: " + processStream + "\n";
}
}
throw new AppiumServerHasNotBeenStartedLocallyException(msgTxt, e);
}
} finally {
lock.unlock();
}
}