Search
 
 

Display results as :
 


Rechercher Advanced Search

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

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

View previous topic View next topic Go down

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

Post by saivik 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

saivik
Active particpant
Active particpant

Posts : 12
Join date : 2009-11-06

Back to top Go down

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

Post by Adviser 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

Adviser
------------------------
------------------------

Posts : 379
Join date : 2009-07-30
Location : India

http://seleniumforum.forumotion.net

Back to top Go down

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

Post by saivik 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".

saivik
Active particpant
Active particpant

Posts : 12
Join date : 2009-11-06

Back to top Go down

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

Post by Adviser 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.

Adviser
------------------------
------------------------

Posts : 379
Join date : 2009-07-30
Location : India

http://seleniumforum.forumotion.net

Back to top Go down

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

Post by saivik 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.

saivik
Active particpant
Active particpant

Posts : 12
Join date : 2009-11-06

Back to top Go down

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

Post by Sponsored content Today at 3:09 pm


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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