Share
Go down
saivik
Active particpant
Active particpant
Posts : 12
Join date : 2009-11-06

How to capture the messages shown by response.write() method

on Thu Nov 26, 2009 3:35 pm
Hi,
how to capture the alert message that is shown via response.write()

My code snippet:
Code:
if (Requestaction == "add")
                    {
                        strTemp = "<script language='javascript'>
        alert('New Record successfully created and the Requisition number is " + strReqNumber + "');
                        </script>";
                        Response.Write(strTemp);
                    }

I am getting an alert after clicking on add button in the UI.
The alert is being generated from Response.Write()

So. my script is,
Code:
selenium.chooseOkOnNextConfirmation();
        selenium.click("btnAdd");
        selenium.getAlert();

But, the log says, there were no alerts. The test is failing.

How to capture the alert generated from Response.Write()
Pls help with this.

-Saivik
avatar
Advisor
------------------------
------------------------
Posts : 383
Join date : 2009-07-30
Location : India
http://seleniumforum.forumotion.net

Re: How to capture the messages shown by response.write() method

on Wed Dec 02, 2009 11:33 am
hi,

First try to use storeAlert to know whether is there any alert present or not. After you getting all information than you proceed further to perform some operation on alert .

Because when u execute the code, some alert is occurring in background and handle at there only.

Best of luck.

Bye
saivik
Active particpant
Active particpant
Posts : 12
Join date : 2009-11-06

Re: How to capture the messages shown by response.write() method

on Wed Dec 02, 2009 2:35 pm
I tried using storeAlert, but it is failing and showing error msg as "There are no alerts".
avatar
Advisor
------------------------
------------------------
Posts : 383
Join date : 2009-07-30
Location : India
http://seleniumforum.forumotion.net

Re: How to capture the messages shown by response.write() method

on Wed Dec 02, 2009 9:32 pm
then don't use the command to handle the alert. just move on to test command.

It will be possible that alert appearing before and you handle it later or vice-versa.
saivik
Active particpant
Active particpant
Posts : 12
Join date : 2009-11-06

Re: How to capture the messages shown by response.write() method

on Thu Dec 03, 2009 2:39 pm
When that alert pops up, i cannot perform any actions like clicking logout button/link, accessing any other page...
until i click on 'OK' button in that alert popup. and i am not able to click on that 'OK' button through any of the commands.
Sponsored content

Re: How to capture the messages shown by response.write() method

Back to top
Permissions in this forum:
You cannot reply to topics in this forum