Hey everyone, I've spent the past couple of days scouring the internet trying to find a solution to my modal dialog problem. There's a wealth of helpful information out there and everything works perfectly fine except for Internet Explorer. Specifically, I'm facing an issue when attempting to open a file upload dialog and select a new file. I've created autoIT scripts that work flawlessly with Firefox and Chrome, but encounter a roadblock with IE - the "executeScript" doesn't return back to my test scripts after opening the file upload dialog in IE. Strangely enough, running the autoIT script manually allows it to return back to the test script once the file upload dialog closes.
//WebDriver driver = new FirefoxDriver();
// processPage(driver);
WebDriver ieDriver =new InternetExplorerDriver();
processPage(ieDriver);
// WebDriver chromeDriver = new ChromeDriver();
// processPage(chromeDriver);
. . . other code . .
WebElement element = driver.findElement(By.name(uploadDifferntFile));
if (driver instanceof InternetExplorerDriver) {
((InternetExplorerDriver) driver).executeScript("arguments[0].click();", element);
} else if(driver instanceof FirefoxDriver){
((FirefoxDriver) driver).executeScript("arguments[0].click();", element);
} else if(driver instanceof ChromeDriver){
((ChromeDriver) driver).executeScript("arguments[0].click();", element);
}
. . . autoIT . . .
try {
Process proc = Runtime.getRuntime().exec(fileToExecute);
} catch (IOException e) {
System.out.println("Failed to execute autoIT");
e.printStackTrace();
}
Appreciate all the support provided by you guys!