Closing alerts (acknowledgments)

10 views
Skip to first unread message

Janesh

unread,
Oct 1, 2008, 8:51:40 AM10/1/08
to selenium-users...@googlegroups.com
I need to close an alert box appear after creating a new record and this is not recorded by Selenium IDE.

Test Steps
1) Started Selenium IDE . Started Recording
2) Opened a web browser
3) Accessed the AU.
4) Click add new record. Filled the form and submitted.

ACK message box is popped up to show that record is created.

5) Click on the OK button

Step 5 is not recorded.
When recorded test is run it hangs at step 5 and need manual intervention.


How to automated closing alert box?

Thanking you in advance
Janesh


NaskoG

unread,
Oct 7, 2008, 8:10:41 AM10/7/08
to selenium-users...@googlegroups.com
Try using chooseOkOnNextConfirmation and waitForConfirmation commands.

tonk

unread,
Oct 7, 2008, 8:21:48 AM10/7/08
to selenium-users...@googlegroups.com
Use get_alert() function.
Getting an alert has the same effect as manually clicking OK.

Jayaprakash

unread,
Oct 7, 2008, 10:44:02 AM10/7/08
to selenium-users...@googlegroups.com
I too get the same problem. It handles Confirmation dialog boxes. But it doesnt handle acknowledgment alert, which has only OK button
It is really annoying
clickOKonnextconfirmation
get_alert
close
nothing works...is there a bug ?

am running FF2 / Windows XP

Janesh

unread,
Oct 7, 2008, 11:22:02 AM10/7/08
to selenium-users...@googlegroups.com
Hi
Thanks for the responses. I tried them but did not close the alert box.

Here is a sample code (HTML)
<html>\\ <head>\\ </head>\\ <body>\\ \\ Test closing alert boxes in a web page. Test\\ <script type="text/javascript">\\ alert("Your message is saved");\\ </script>\\ test\\ </body>\\ </html>


Here are the Selenium codes
1)
<tbody>\\ <tr>\\ <td>open</td>\\ <td>http://localhost/test.html</td>\\ <td></td>\\ </tr>\\ <tr>\\ <td>chooseOkOnNextConfirmation</td>\\ <td></td>\\ <td></td>\\ </tr>
2)

<tr>\\ <td>get_alert</td>\\ <td></td>\\ <td></td>\\ </tr>


Can you share a working Selenium code ?

Many Thanks
Janesh

Janesh

unread,
Oct 7, 2008, 11:29:34 AM10/7/08
to selenium-users...@googlegroups.com
Hi
Thanks for the reply. I tried the options.
It did not close the Alert box.

Can you share a working Selenim code?

I am using IDE *Version 1.0 Beta 2* with Firefox 3.0.3

Cheers
Janesh.

Jayaprakash

unread,
Oct 7, 2008, 11:47:02 AM10/7/08
to selenium-users...@googlegroups.com
Janesh

I am googling it out. I found this. But I couldnt get thru. give it a go, if you can. pls let me know the result
http://www.nabble.com/How-to-handle-the-application-POPup-window-messages-using-selenium-IDE-td15240134.html

tonk

unread,
Oct 7, 2008, 9:42:32 PM10/7/08
to selenium-users...@googlegroups.com
we should use assertAlert or assertConfirmation In selenium IDE.
How about?

Jayaprakash

unread,
Oct 8, 2008, 8:06:33 AM10/8/08
to selenium-users...@googlegroups.com
Tonk
Those two APIs ever worked for you ? i mean Did you ever ry that ?

I tried all of this, nothing works for me
asserConfirm, assertAlert, assertAlertPresent, selectWindow ("title"), assertPrompt, assertPromptConfirmation, chooseOkOnNextConfirmation,chooseOkOnNextConfirmationAndWait, CloseWindow

looke like there is known issue in catching the alert. The work around suggested for it selectWindow and execute any of these commands

However, it is not recognizing the pop up (ack confirmation window) and throws an error : No window found with "so on so title"
Is there any way to get Window Id of all opened windows (preferrably in Perl Driver code) ? If we can get window id. we can select concerned window and close or perform any of above mentioned operations easily

Reply all
Reply to author
Forward
0 new messages