Closed seanirwin closed 7 years ago
I think you are trying to handle the alert too soon. I've made a wrapper function that's throw "unexpected alert open" exceptions and waits for getting the text of the alert. That's not the most elegant solution, but at least it works for my case.
Can also be closed, switchTo()
command for alert isn't referenced in the webdriver spec.
Moreover, alertIsPresent()
method has been added and should do what you want.
When a JavaScript alert is on the page I am unable to access the acceptAlert()/alertText()/declineAlert() methods, I can only test for expectedExceptions. Is there a way to switch to the alert dialog or other dialogs?
@expectedException PHPUnit_Extensions_Selenium2TestCase_WebDriverException unexpected alert open
Java documentation suggest that you can switch to the alert window, but there doesn't seem to be a comparable method in the phpunit-selenium library. driver.switchTo().alert();