This is a migrated thread and some comments may be shown as answers.

The Alert dialog is getting closed immediately before doing any operation on it in WebAii

6 Answers 113 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Hemashree
Top achievements
Rank 1
Hemashree asked on 08 Dec 2010, 12:42 PM

Hi,

I am trying to open one Alert dialog and do some operation on it using webAii automation.The scenario is like this:

1.I want to delete a record.So I am selecting one record

2.Clicking on Remove selecetd record button.Onclick of this I am getting one Alert dialog.

3.After clicking on this button the Alert pop up is coming  and it is getting closed before the test script goes to next line

4.I am not able to capture the dialog in Dialog monitor

Please help me on this.

6 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 08 Dec 2010, 08:36 PM
Hi Hemashree,

What may be happening is our "Unexpected Dialog Handler" feature is getting in the way. Try turning it off using this line of code at the beginning of your test:

Manager.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;

Greetings,
Cody
the Telerik team
Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
0
Hemashree
Top achievements
Rank 1
answered on 09 Dec 2010, 06:05 AM
Hi,

Thanks a lot for your reply.....
Now what is happening is the Alert dialog which is opened is not getting closed immediately but still it is not going to the next line of code.It will be there in that same line of test and the status will be Processing only in the Browser.

Please help me to resolve this.

Thanks,
Hemashree
0
Cody
Telerik team
answered on 09 Dec 2010, 01:55 PM
Hi Hemashree,

I need to see a screenshot of this alert dialog along with your test code. Once you post that I will study it to try and determine why it's not working as expected.

Kind regards,
Cody
the Telerik team
Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
0
Hemashree
Top achievements
Rank 1
answered on 13 Dec 2010, 02:08 PM
Hi,

Thanks for the reply.

The code looks like this:
  Manager.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;
                Log.WriteLine(Find.ById<HtmlInputCheckBox>("ScheduleList_ctl00_ctl04_ScheduleSelectSelectCheckBox").Value);
               //Click on RemoveSelected button
                Find.ById<HtmlInputSubmit>("delete2").Click();
              //Handle Alert Dialog
                Manager.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;
                AlertDialog altDlg = new AlertDialog(ActiveBrowser, DialogButton.OK);
                Manager.DialogMonitor.AddDialog(altDlg);
                Manager.DialogMonitor.Start();
                //altDlg.WaitUntilHandled(1000);
                Manager.DialogMonitor.RemoveDialog(altDlg);


0
Hemashree
Top achievements
Rank 1
answered on 15 Dec 2010, 02:11 PM
Hi,


Please help me to resolve the below issue as I am I need the solution immediately....

-Thanks,
Hemashree
0
Cody
Telerik team
answered on 15 Dec 2010, 09:16 PM
Hello Hemashree,

Thank you for that additional information. I think I see what the problem is. You need to setup your dialog handler before you click on the button that causes the alert to open. The dialog handler only watches for new dialogs after the object has been created. It will ignore dialogs that already are present at the time you create your dialog handler.

Please try this code instead:

Manager.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;
 
Log.WriteLine(Find.ById<HtmlInputCheckBox>("ScheduleList_ctl00_ctl04_ScheduleSelectSelectCheckBox").Value);
 
//Setup Alert Dialog Handler
AlertDialog altDlg = new AlertDialog(ActiveBrowser, DialogButton.OK);
Manager.DialogMonitor.AddDialog(altDlg);
Manager.DialogMonitor.Start();
 
//Click on RemoveSelected button
Find.ById<HtmlInputSubmit>("delete2").Click();
 
// Wait until the dialog has been handled
altDlg.WaitUntilHandled(1000);
Manager.DialogMonitor.RemoveDialog(altDlg);

All the best,
Cody
the Telerik team
Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
Tags
General Discussions
Asked by
Hemashree
Top achievements
Rank 1
Answers by
Cody
Telerik team
Hemashree
Top achievements
Rank 1
Share this question
or