public int executeAndWait(boolean ignoreErrors) {
start();
int exitCode = waitFor(-1);
if (!ignoreErrors && exitCode != 0) {
throw new WebDriverException(
"execution failed. Exit code =" + exitCode + " , command was: " + commandString());
}
for (Thread t : threads) {
try {
t.join();
} catch (InterruptedException e) {
throw new WebDriverException(e);
}
}
return exitCode;
}