You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.
What steps will reproduce the problem? (Firefox)
1. Open a window that immediately opens and alert
2. Make a call to getWindowHandles(), and switch to the previous window
3. Switch to the window that opened the alert
4. Attempt to accept the alert
driver.getWindowHandles();
driver.switchTo().window("window1");
driver.switchTo().window("window2"); // the window with the alert
driver.switchTo().alert().accept();
What is the expected output? What do you see instead?
In the case above, we expect the driver to switch to window1, then to window2, and
finally to accept the alert.
The above will fail with an org.openqa.selenium.NoAlertPresentException. However, if
you remove the call to getWindowHandles() or the call to driver.switchTo().window("window1"),
the alert will be successfully closed.
In the case of Chrome, we are unable to close the alert dialogue even when those two
lines are removed.
Selenium version: 2.42.2
OS: Windows 7 64bit
Browser: Firefox 31.0 /Chrome 36.0.1985.143
Please provide any additional information below.
WebDriver driver = new FirefoxDriver();
driver.get("index.html");
String path = "/descendant::div[normalize-space(.)=\"open a window\"]";
WebElement element = driver.findElement(By.xpath(path));
Actions builder = new Actions(driver);
builder.click(element).perform();
driver.getWindowHandles();
driver.switchTo().window("window1");
driver.switchTo().window("window2");
driver.switchTo().alert().accept();
Reported by para.selenium.bugs on 2014-08-29 23:54:32
The attached sample opens a new window, but it does not immediately open an alert in
the new window.
Nevertheless, I've fixed the sample and reproduced the issue.
Originally reported on Google Code with ID 7807
Reported by
para.selenium.bugs
on 2014-08-29 23:54:32- _Attachment: [index.html](https://storage.googleapis.com/google-code-attachments/selenium/issue-7807/comment-0/index.html)_ - _Attachment: [opened.html](https://storage.googleapis.com/google-code-attachments/selenium/issue-7807/comment-0/opened.html)_
The text was updated successfully, but these errors were encountered: