本文整理汇总了Java中org.openqa.selenium.os.CommandLine.isRunning方法的典型用法代码示例。如果您正苦于以下问题:Java CommandLine.isRunning方法的具体用法?Java CommandLine.isRunning怎么用?Java CommandLine.isRunning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openqa.selenium.os.CommandLine
的用法示例。
在下文中一共展示了CommandLine.isRunning方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeCommand
import org.openqa.selenium.os.CommandLine; //导入方法依赖的package包/类
public void executeCommand() throws Throwable {
JavaProfile profile = new JavaProfile(LaunchMode.JAVA_COMMAND_LINE).setMainClass("-version");
final CommandLine commandLine = profile.getCommandLine();
AssertJUnit.assertNotNull(commandLine);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
commandLine.copyOutputTo(baos);
commandLine.executeAsync();
new Wait("Waiting till the command is complete") {
@Override public boolean until() {
return !commandLine.isRunning();
}
};
BufferedReader reader = new BufferedReader(new StringReader(new String(baos.toByteArray())));
String line = reader.readLine();
while (line != null && !line.contains("java version")) {
line = reader.readLine();
}
AssertJUnit.assertTrue(line.contains("java version"));
}
示例2: executeWSCommand
import org.openqa.selenium.os.CommandLine; //导入方法依赖的package包/类
public void executeWSCommand() throws Throwable {
if (OS.isFamilyWindows()) {
throw new SkipException("Test not valid for Windows");
}
JavaProfile profile = new JavaProfile(LaunchMode.JAVA_WEBSTART).addWSArgument("-verbose").addVMArgument("-Dx.y.z=hello");
final CommandLine commandLine = profile.getCommandLine();
AssertJUnit.assertNotNull(commandLine);
AssertJUnit.assertTrue(commandLine.toString().contains("-javaagent:"));
AssertJUnit.assertTrue(commandLine.toString().contains("-verbose"));
AssertJUnit.assertTrue(commandLine.toString().contains("-Dx.y.z=hello"));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
commandLine.copyOutputTo(baos);
commandLine.executeAsync();
new Wait("Waiting till the command is complete") {
@Override public boolean until() {
return !commandLine.isRunning();
}
};
BufferedReader reader = new BufferedReader(new StringReader(new String(baos.toByteArray())));
String line = reader.readLine();
while (line != null && !line.contains("Web Start")) {
line = reader.readLine();
}
AssertJUnit.assertTrue(line.contains("Web Start"));
}
示例3: start
import org.openqa.selenium.os.CommandLine; //导入方法依赖的package包/类
public void start() {
if (profile.isEmbedded()) {
if (server != null) {
return;
}
int port = getAddressOfRemoteServer().getPort();
server = new EmbeddedServer(profile);
try {
server.start(port);
} catch (IOException e) {
throw new WebDriverException("Unable to start the server on port " + port, e);
}
} else {
final CommandLine command = profile.getCommandLine();
Logger.getLogger(JavaDriverCommandExecutor.class.getName()).info("Executing: " + command);
command.copyOutputTo(profile.getOutputStream());
command.executeAsync();
new Wait() {
@Override public boolean until() {
return isConnected() || !profile.isJavaWebStart() && !Boolean.getBoolean(MARATHON_APPLICATION_DONT_MONITOR)
&& !command.isRunning();
}
}.wait("Timedout waiting for the server to start", Long.getLong("marathon.application.wait", Wait.DEFAULT_TIMEOUT * 5));
if (!isConnected() && !command.isRunning()) {
throw new WebDriverException("Unable to launch the application. command = " + command);
}
}
}