How can I press the OK button in a JS alert programmatically?
What I want to do: every time after the alert is created, the OK button is pressed.
This is for
$this->chooseOkOnNextConfirmation();
$this->click('locator');
$this->getConfirmation();
The above process worked for me using Selenium RC with PHPUnit
You can't. Unless you use something that can control the browser (e.g. selenium).
If you do use selenium, have a look at Click in OK button inside an Alert (Selenium IDE)