views:

1304

answers:

2

I have a button that displays Javascript confirmation popup. This is a part of my test case:

<tr>
    <td>clickAndWait</td>
    <td>buttonId</td>
    <td></td>
</tr>
<tr>
    <td>verifyTextPresent</td>
    <td>Object has been deleted</td>
    <td></td>
</tr>

It works as expected: OK is clicked automatically on a popup and verifyTextPresent return true. Still, I get [error] There was an unexpected Confirmation! in the log and test case fails.

Any suggestions?

+6  A: 

You have to consume confirmation dialogs. Otherwise the Selenium test will fail.

From the Java Selenium RC API Selenium.html.getConfirmation method:

If an confirmation is generated but you do not consume it with getConfirmation, the next Selenium action will fail.

Edit:

storeConfirmation consumes the confirmation as well.

storeConfirmation ( variableName )

Retrieves the message of a JavaScript confirmation dialog generated during the previous action.

If an confirmation is generated but you do not consume it with getConfirmation, the next Selenium action will fail.

Thomas Jung
But how can I do this from Selenium IDE (firefox plugin)? There is no command like getConfirmation available there.
Ula Krukar
A: 

I encountered the same problem, and I solved it like this:

chooseOkOnNextConfirmation click buttonId assertConfirmation

This makes my test run green in my Selenium IDE.

Knubo