So I've noticed that Java has the ability to handle unexpected alerts using the UnexpectedAlertBehaviour capability that came out with Selenium 2.25.0. You can see the CHANGELOG. It would be helpful for me to always accept the alerts and for the script to continue on because I can't always predict when they will pop up.
If you have done any coding with Drupal's ctools and it's ajax framework, you will understand why... Selenium sometimes goes too fast for an ajax call to complete and ctools throws up a dialog explaining the error of why the ajax call didn't complete.
So finally, Is it even possible to perform this functionality using webdriver's rest API (from which mink's webdriver is dirived)? Does anyone know how to set it up either via mink or behat using mink (via yaml or php code)?
You could add add some js to disable alerts when running your features with this step def
/**
* @When /^I disable the alerts$/
*/
public function iDisableTheAlerts()
{
$javascript = <<<JS
window.alert = function() {};
JS;
$this->getSession()->executeScript($javascript);
}
This would in effect just override the alert function and do a null return so that any js would keep running.
Depending on your browser it you might want to try different ways of overriding it if this doesn't work.
You could just disable alerts completely in your app instead of injecting it through behat but this would still preserve the alert as some kind of... cough cough... "desired functionality by design".