else if (driverOptions.has(DriverOption.IEDRIVER))
driverName = WebDriverManager.IE;
else if (driverOptions.has(DriverOption.PHANTOMJS))
driverName = WebDriverManager.PHANTOMJS;
}
WebDriverManager manager = WebDriverManager.getInstance();
manager.setWebDriverFactory(driverName);
manager.setDriverOptions(driverOptions);
Runner runner = new Runner();
if (cli.hasOption("command-factory")) {
String factoryName = cli.getOptionValue("command-factory");
ICommandFactory factory;
try {
Class<?> factoryClass = Class.forName(factoryName);
factory = (ICommandFactory) factoryClass.newInstance();
} catch (Exception e) {
e.printStackTrace();
throw new IllegalArgumentException("invalid user defined command factory: " + factoryName);
}
runner.getCommandFactory().registerCommandFactory(factory);
log.info("Registered: {}", factoryName);
}
runner.setCommandLineArgs(args);
runner.setDriver(manager.get());
runner.setWebDriverPreparator(manager);
runner.setHighlight(cli.hasOption("highlight"));
runner.setScreenshotDir(cli.getOptionValue("screenshot-dir"));
runner.setScreenshotAllDir(cli.getOptionValue("screenshot-all"));
runner.setScreenshotOnFailDir(cli.getOptionValue("screenshot-on-fail"));