Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

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

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

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
Advisor
Advisor
------------------------
------------------------
Posts : 387
Join date : 2009-07-30
Location : India
https://seleniumforum.forumotion.net

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

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
avatar
saivik
Active particpant
Active particpant
Posts : 12
Join date : 2009-11-06

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

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

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

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.
avatar
saivik
Active particpant
Active particpant
Posts : 12
Join date : 2009-11-06

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

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

How to capture the messages shown by response.write() method Empty 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