Hi Telerik team,
The scneario is like this :
- In the main window of the application I am opening a pop window
- Clicking on link button in pop up window
- The pop up window gives an alert dialog with OK button
- Clicking on OK buttton in the Alert dialog which closes the Alert dialog
Expected result: Alert dialog will be closed.
Actually result: Alert dialog is not handled.
Following is my code implementation. Please help to clarify.
sorry, I cannot find a public site to demo this scenario.
You can replace the URL with your local html.
Regards,
Jeffery
The scneario is like this :
- In the main window of the application I am opening a pop window
- Clicking on link button in pop up window
- The pop up window gives an alert dialog with OK button
- Clicking on OK buttton in the Alert dialog which closes the Alert dialog
Expected result: Alert dialog will be closed.
Actually result: Alert dialog is not handled.
Following is my code implementation. Please help to clarify.
sorry, I cannot find a public site to demo this scenario.
You can replace the URL with your local html.
Settings settings =
new
Settings();
settings.Web.DefaultBrowser = ArtOfTest.WebAii.Core.BrowserType.FireFox;
settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;
Manager manager =
new
Manager(settings);
manager.Start();
manager.LaunchNewBrowser();
manager.DialogMonitor.Start();
// Setup dialog monitoring.
AlertDialog alertDialog = AlertDialog.CreateAlertDialog(manager.ActiveBrowser, DialogButton.OK);
manager.DialogMonitor.AddDialog(alertDialog);
// Set new browser tracking to enabled.
// This will make all new browser instances connect to the Manager.
manager.SetNewBrowserTracking(
true
);
manager.ActiveBrowser.NavigateTo(
"http://localhost:60444/ConduitGenericWebSite/Default.aspx"
);
Element confButton = manager.ActiveBrowser.Find.ById(
"lnkShowPopup"
);
(
new
HtmlControl(confButton)).Click();
// Wait for the new browser instance to connect.
manager.WaitForNewBrowserConnect(
"http://localhost:60444/ConduitGenericWebSite/ChildPage.aspx"
,
true
, 10000);
// disable new browser tracking
manager.SetNewBrowserTracking(
false
);
// Click to invoke AlertDialog.
Element confButton1 = manager.ActiveBrowser.Find.ById(
"lnkShowConfirmAndAlert"
);
(
new
HtmlControl(confButton1)).Click(
true
);
alertDialog.WaitUntilHandled(3000);
Regards,
Jeffery
8 Answers, 1 is accepted
0
Hello Jeffery,
All the best,
Anthony
the Telerik team
I confirmed that the Alert dialog is not properly handled when launched from a popup window in Firefox. I logged a bug for t and you can find the PITS Issue here: Public URL.
As a work-around in the meantime you can use the Enter key to handle the Alert if executing in Firefox:
Manager.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;
Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
Manager.SetNewBrowserTracking(
true
);
ActiveBrowser.NavigateTo(
"C:\\html\\popup.html"
);
AlertDialog ad = AlertDialog.CreateAlertDialog(ActiveBrowser, DialogButton.OK);
Manager.DialogMonitor.AddDialog(ad);
Manager.DialogMonitor.Start();
HtmlAnchor a = Find.ById<HtmlAnchor>(
"withAlert"
);
a.Click();
Manager.WaitForNewBrowserConnect(
"confirm.html"
,
true
, 5000);
Manager.SetNewBrowserTracking(
false
);
HtmlInputButton b = Find.ByExpression<HtmlInputButton>(
"tagname=input"
,
"value=Show Regular Alert"
);
b.Click();
if
(ActiveBrowser.BrowserType == BrowserType.InternetExplorer)
{
ad.WaitUntilHandled(5000);
}
if
(ActiveBrowser.BrowserType == BrowserType.FireFox)
{
System.Threading.Thread.Sleep(1000);
Desktop.KeyBoard.KeyPress(Keys.Enter);
}
ActiveBrowser.Close();
Manager.DialogMonitor.RemoveDialog(ad);
Manager.DialogMonitor.Stop();
All the best,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Test Studio Trainings
0

Jeffery
Top achievements
Rank 1
answered on 12 Apr 2012, 06:42 AM
Hi Anthony,
Thanks for your feedback.
I saw your description for the bug:
" Works correctly if dialog is launched from parent window.
Fails if dialog is launched from child popup window."
Actually, there is another issue I want to report.
After the popup window displayed, the JS dialog won't be handled even it's launched form parent window.
The scneario is like this :
- In the main window of the application I am opening a pop window
- Clicking on link button in pop up window
- The pop up window gives an alert dialog with OK button
- Clicking on OK buttton in the Alert dialog which closes the Alert dialog (Fail)
- Clicking on another link button in main window to display an Alert dialog
- Clicking on OK buttton in the Alert dialog which closes the Alert dialog (Fail)
Please help to confirm whether is the same issue with my first question.
Regards,
Jeffery
Thanks for your feedback.
I saw your description for the bug:
" Works correctly if dialog is launched from parent window.
Fails if dialog is launched from child popup window."
Actually, there is another issue I want to report.
After the popup window displayed, the JS dialog won't be handled even it's launched form parent window.
The scneario is like this :
- In the main window of the application I am opening a pop window
- Clicking on link button in pop up window
- The pop up window gives an alert dialog with OK button
- Clicking on OK buttton in the Alert dialog which closes the Alert dialog (Fail)
- Clicking on another link button in main window to display an Alert dialog
- Clicking on OK buttton in the Alert dialog which closes the Alert dialog (Fail)
Please help to confirm whether is the same issue with my first question.
Regards,
Jeffery
0
Hello Jeffery,
What I meant in the bug description is that the dialog is correctly handled in Firefox is there's no popup window involved. In other words, the following works:
I'm confused by your updated scenario:
Steps 1-4 match your original scenario which we discovered is a bug. How is the test continuing to step 5 if step 4 fails? How are you returning focus to the main window without properly handling the dialog in step 4 and then closing the popup?
Kind regards,
Anthony
the Telerik team
What I meant in the bug description is that the dialog is correctly handled in Firefox is there's no popup window involved. In other words, the following works:
- Navigate to page
- Click button
- Handle Alert dialog
I'm confused by your updated scenario:
- In the main window of the application I am opening a pop window
- Clicking on link button in pop up window
- The pop up window gives an alert dialog with OK button
- Clicking on OK button in the Alert dialog which closes the Alert dialog (Fail)
- Clicking on another link button in main window to display an Alert dialog
- Clicking on OK button in the Alert dialog which closes the Alert dialog (Fail)
Kind regards,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Test Studio Trainings
0

Jeffery
Top achievements
Rank 1
answered on 13 Apr 2012, 03:19 AM
Hi Anthony,
Sorry for confusion.
I refine the scenario as follow, please check again:
- In the main window of the application I am opening a pop window
- Clicking on link button in main window to display an Alert dialog
- Clicking on OK buttton in the Alert dialog which closes the Alert dialog (Fail)
Expected result: Alert dialog will be closed.
Actually result: Alert dialog is not handled.
I removed the step:
- Clicking on OK buttton in the Alert dialog which closes the Alert dialog (Fail)
My point is that JS dialog cannot be handled correctly (both in popup window and main window) if there is a popup window involved.
Any more information please let me know.
Regards,
Jeffery
Sorry for confusion.
I refine the scenario as follow, please check again:
- In the main window of the application I am opening a pop window
- Clicking on link button in main window to display an Alert dialog
- Clicking on OK buttton in the Alert dialog which closes the Alert dialog (Fail)
Expected result: Alert dialog will be closed.
Actually result: Alert dialog is not handled.
I removed the step:
- Clicking on OK buttton in the Alert dialog which closes the Alert dialog (Fail)
My point is that JS dialog cannot be handled correctly (both in popup window and main window) if there is a popup window involved.
Any more information please let me know.
Regards,
Jeffery
0
Hello Jeffery,
I cannot replicate that scenario. The following works for me in FF:
You don't mention step 3 in your case. Are you closing the popup so focus is properly returned to the main window? Perhaps another code sample will shed some light on this.
Regards,
Anthony
the Telerik team
I cannot replicate that scenario. The following works for me in FF:
- From main window open popup.
- Perform actions/verifications within popup.
- Close popup.
- Click link in main window to launch Alert dialog.
- Handle alert.
You don't mention step 3 in your case. Are you closing the popup so focus is properly returned to the main window? Perhaps another code sample will shed some light on this.
Regards,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Test Studio Trainings
0

Jeffery
Top achievements
Rank 1
answered on 16 Apr 2012, 02:18 AM
Hi Anthony,
Yes, in my scenario, I don't have step 3 (Close popup).
The point is you should keep the popup opening and click link in main window to launch Alert dialog.
At this time, the Javascript dialog cannot be handled.
I want to confirm whether this issue is the same with the first one (Javascript dialog cannot be handled in popup window).
Thanks very much.
Regards,
Jeffery
Yes, in my scenario, I don't have step 3 (Close popup).
The point is you should keep the popup opening and click link in main window to launch Alert dialog.
At this time, the Javascript dialog cannot be handled.
I want to confirm whether this issue is the same with the first one (Javascript dialog cannot be handled in popup window).
Thanks very much.
Regards,
Jeffery
0
Hello Jeffery,
Anthony
the Telerik team
This behavior is slightly different, however I feel it's related to the original issue. I've updated the internal description accordingly in the bug report.
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Test Studio Trainings
0

Jeffery
Top achievements
Rank 1
answered on 17 Apr 2012, 10:22 AM
I see. Thanks for your update.
Jeffery
Jeffery