use of org.openqa.selenium.chrome.ChromeDriver in project ats-framework by Axway.
the class RealHtmlFileBrowse method setValueUsingNativeDialog.
/**
* This method allows you to type in dialog windows. This option is available only for Windows OS
*
* @param path add the location of the file, you want to type in the dialog window
* @throws Exception
*/
@PublicAtsApi
public void setValueUsingNativeDialog(String path) throws Exception {
if (!OperatingSystemType.getCurrentOsType().isWindows()) {
throw new RuntimeException("This method is only available for Windows machines!");
}
// check if the file exist
if (!new File(path).exists()) {
throw new FileNotFoundException("File path \"" + path + "\" is wrong or does not exist!");
}
// ats_file_upload.exe location
String uploadFileDestination = System.getProperty("user.dir") + "\\ats_file_upload.exe";
// native window name
String windowName;
log.info("Using native " + path + " to work with native browser dialogs");
// check if the ats_file_upload.exe file is already created
if (!new File(uploadFileDestination).exists()) {
OutputStream os = null;
InputStream is = null;
try {
// get the ats_file_upload.exe file, located in the ats-uiengine.jar
is = getClass().getClassLoader().getResourceAsStream("binaries/ats_file_upload.exe");
if (is == null) {
throw new FileNotFoundException("The 'ats_file_upload.exe' file is not found in ats-uiengine.jar!");
}
File uploadFile = new File(uploadFileDestination);
os = new FileOutputStream(uploadFile);
IOUtils.copy(is, os);
} finally {
IoUtils.closeStream(is);
IoUtils.closeStream(os);
}
}
if (webDriver instanceof FirefoxDriver) {
windowName = " \"File Upload\" ";
} else if (webDriver instanceof ChromeDriver) {
windowName = " \"Open\" ";
} else {
throw new RobotException("Not Implemented for your browser! Currently Firefox and " + "Chrome are supported.");
}
// add the browse button properties
((AbstractRealBrowserDriver) super.getUiDriver()).getHtmlEngine().getElement(properties).click();
// run the ats_file_upload.exe file
IProcessExecutor proc = new LocalProcessExecutor(HostUtils.LOCAL_HOST_IPv4, uploadFileDestination + windowName + path);
proc.execute();
// check if there is any error, while executing the ats_file_upload.exe file
if (proc.getExitCode() != 0) {
log.error("AutoIT process for native browser interaction failed with exit code: " + proc.getExitCode() + ";");
log.error("Output stream data: " + proc.getStandardOutput() + ";");
log.error("Error stream data: " + proc.getErrorOutput());
throw new RobotException("AutoIT process for native browser interaction failed.");
}
}
use of org.openqa.selenium.chrome.ChromeDriver in project ddd-cqrs-sample by BottegaIT.
the class BrowserAgentDriverProvider method createChromeDriver.
@Override
protected ChromeDriver createChromeDriver() {
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
String chromeBinary = System.getProperty("chrome.binary");
if (StringUtils.isNotBlank(chromeBinary)) {
capabilities.setCapability("chrome.binary", chromeBinary);
}
return new ChromeDriver(capabilities);
}
use of org.openqa.selenium.chrome.ChromeDriver in project muikku by otavanopisto.
the class AbstractUITest method createChromeDriver.
protected RemoteWebDriver createChromeDriver() {
ChromeOptions options = new ChromeOptions();
options.addArguments("--lang=en_US");
options.addArguments("--start-maximized");
ChromeDriver chromeDriver = new ChromeDriver(options);
return chromeDriver;
}
use of org.openqa.selenium.chrome.ChromeDriver in project antlr4 by antlr.
the class SharedWebDriver method init.
public static WebDriver init() {
if (driver == null) {
String path = SharedWebDriver.class.getPackage().getName().replace(".", "/") + "/chromedriver.bin";
URL url = Thread.currentThread().getContextClassLoader().getResource(path);
// skip 'file:'
File file = new File(url.toExternalForm().substring(5));
assertTrue(file.exists());
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
driver = new ChromeDriver();
} else if (timer != null) {
timer.cancel();
timer = null;
}
return driver;
}
use of org.openqa.selenium.chrome.ChromeDriver in project flow by vaadin.
the class ChromeBrowserTest method createHeadlessChromeDriver.
private WebDriver createHeadlessChromeDriver() {
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless", "--disable-gpu");
return TestBench.createDriver(new ChromeDriver(options));
}
Aggregations