My code looks like:
getDriver().findElement(By.id("ok_button")).click();
new WebDriverWait(getDriver(), 5).until(ExpectedConditions.alertIsPresent());
assertTrue(isAlertPresent());
Alert alert = getDriver().switchTo().alert();
assertTrue(alert.getText().equals("Please select a group"));
alert.accept();
dialogBox.setRefVariable(inputId, "group1");
getDriver().findElement(By.id("ok_button")).click();
new WebDriverWait(getDriver(), 5).until(ExpectedConditions.alertIsPresent());
The first alert shows and is correctly accepted, but the second alert won't show. I get an error on the last line because, after 5 seconds, the alert isn't present. When I debug the code and manually click the button, the alert still won't show. Even when I open the console on the firefox window and manually enter just "alert("..")", nothing pops up.
I'm using FireFox22 and Selenium 2.31
edit: Problem appears to be the line containing setRefVariable
(our own code). Removing the line allows everything to work.
edit: Our code ends up calling Selenium.type, which causes Selenium to execute some code which overrides the native alert function... why????