Firefox alert box not detected with Selenium WebDriver
<blockquote>
  <p>ERROR net.serenitybdd.core.Serenity - No alert is present (WARNING:
  The server did not provide any stacktrace information)</p>
</blockquote>

<p>I get this error when I try to detect an alert with this code:</p>

<pre><code>Alert alertBox = getDriver().switchTo().alert();
</code></pre>

<p>The alert popup does show up, but it is not exactly the same when I execute the operation via Selenium WebDriver and manualy. This might be the source of the problem but I don't know why the popup is different.</p>

<p><a href="http://i.stack.imgur.com/EJZX7.jpg" rel="nofollow">The alert when done manualy</a></p>

<p><a href="http://i.stack.imgur.com/n28l5.jpg" rel="nofollow">The alert when done with Selenium</a></p>

<p>This is the function that calls the alert:</p>

<pre><code>function confirm_remove() {
    return window.confirm("Alert message");
}
</code></pre>

<p>Thanks for your help</p>

<p><strong>UPDATE:</strong></p>

<p>Ok I found a way to bypass the problem but not really solve it.</p>

<p>I tried inserting waits and sleep like you suggested me to but it did not solve the problem, the alert was still undetected.</p>

<p>In my project I am using a Test class which calls steps from my Steps class which calls webElements from my Page class. The thing is that between the step which clicks on the "Delete" button and the step that manages the alert, Selenium loses the handling of the alert. So I regrouped those two steps and Selenium seems to handle the alert well.</p>