Closed GoogleCodeExporter closed 9 years ago
Original comment by samu...@chromium.org
on 21 Feb 2015 at 12:18
Issue is reproducible when Html contains beforeUnload functionality.
ChromeDriver:2.14, Chrome:v41, Windows 7
When user tries to navigate to different page from current page, 'Confirm
navigation' message is displayed, on which user is allowed to select
'Leave page' and 'Stay on page'.
Through chromedriver, we are unable to select 'Leave page' or 'Stay on page' by
using alert.accept() / alert.dismiss().
But through FirefoxDriver user able to select 'Leave page' or 'Stay on page' by
using alert.accept() / alert.dismiss()
Html:
<html>
<head></head>
<body>
Test Before Unload
<script>
var myEvent = window.attachEvent || window.addEventListener;
var chkevent = window.attachEvent ? 'onbeforeunload' : 'beforeunload'; /// make
IE7, IE8 compitable
myEvent(chkevent, function(e) { // For >=IE7, Chrome, Firefox
var confirmationMessage = 'Before unload confirmation message'; // a space
(e || window.event).returnValue = confirmationMessage;
return confirmationMessage;
});
</script>
</body></html>
Java:
String url = "Html/Bug_901.html";
String driverPath="drivers/chromedriver.exe";
System.setProperty("webdriver.chrome.driver",driverPath);
WebDriver driver = new ChromeDriver();
driver.get(url);
driver.close();
WebDriverWait wait = new WebDriverWait(driver, 2);
wait.until(ExpectedConditions.alertIsPresent());
Alert alert=driver.switchTo().alert();
alert.accept();
Original comment by ssudunag...@chromium.org
on 25 Mar 2015 at 5:29
Original comment by gmanikp...@chromium.org
on 25 Mar 2015 at 4:40
Original issue reported on code.google.com by
para.sel...@gmail.com
on 15 Sep 2014 at 7:52