Koti Reddy
Top achievements
Rank 1
Koti Reddy
asked on 29 May 2012, 01:18 PM
Hii,
I am not able to get the handle of new modal window ,which i am opening by
clicking some button. Window gets opened but browser count is not increasing.
Its working for non modal html windows .ANY HELP
?????
I am not able to get the handle of new modal window ,which i am opening by
clicking some button. Window gets opened but browser count is not increasing.
Its working for non modal html windows .ANY HELP
?????
3 Answers, 1 is accepted
0
Hello Koti,
It writes the following to the test log:
Regards,
Anthony
the Telerik team
Modal Popups require special code and should be handled as demonstrated here.
Here is additional sample code I wrote against a public site with a Modal Popup:
Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
ActiveBrowser.NavigateTo(
"http://www.codestore.net/store.nsf/unid/DOMM-4R5MDQ"
);
Manager.SetNewBrowserTracking(
true
);
Log.WriteLine(
"Browser Count: "
+ Manager.Browsers.Count.ToString());
Find.ByContent<HtmlAnchor>(
"this link"
).ScrollToVisible();
Find.ByContent<HtmlAnchor>(
"this link"
).MouseClick();
if
(ActiveBrowser.BrowserType == BrowserType.InternetExplorer)
{
ArtOfTest.WebAii.BrowserSpecialized.InternetExplorer.InternetExplorerActions ieActions = ((ArtOfTest.WebAii.BrowserSpecialized.InternetExplorer.InternetExplorerActions)(ActiveBrowser.Actions));
ieActions.ConnectIEDialog(
"A Modal Pop-Up -- Webpage Dialog"
, 5000);
Manager.WaitForNewBrowserConnect(
"simple.html"
,
true
, 5000);
Assert.IsTrue(ActiveBrowser.IsIEDialog);
//Manager.ActiveBrowser.WaitUntilReady();
Log.WriteLine(
"Browser Count: "
+ Manager.Browsers.Count.ToString());
ActiveBrowser.Close();
}
Assert.IsFalse(ActiveBrowser.IsIEDialog);
Log.WriteLine(
"Browser Count: "
+ Manager.Browsers.Count.ToString());
It writes the following to the test log:
[Trace] : Browser Count: 1
[Trace] : Browser Count: 2
[Trace] : Browser Count: 1
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
Koti Reddy
Top achievements
Rank 1
answered on 30 May 2012, 04:08 AM
Thanks Anthony.
Is the code specific to IE? Is it extensible to other browsers as well (Chrome and FF)?
We have these HTML dialogs that are opened via "window.showmodaldialog()". These dialogs show the modal property in IE but fail to do so in Chrome.
However, as I mentioned, attempting to get them as ActiveBrowser does not work.
Is the code specific to IE? Is it extensible to other browsers as well (Chrome and FF)?
We have these HTML dialogs that are opened via "window.showmodaldialog()". These dialogs show the modal property in IE but fail to do so in Chrome.
However, as I mentioned, attempting to get them as ActiveBrowser does not work.
0
Hello Koti,
All the best,
Anthony
the Telerik team
Modal Popups simply require extra code for IE execution. Here's an adapted sample that works in Chrome (and would work in FF as well if FF rendered a URL in the popup):
Manager.Settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle;
Manager.LaunchNewBrowser(BrowserType.Chrome);
ActiveBrowser.NavigateTo(
"http://www.codestore.net/store.nsf/unid/DOMM-4R5MDQ"
);
Manager.SetNewBrowserTracking(
true
);
Log.WriteLine(
"Browser Count: "
+ Manager.Browsers.Count.ToString());
Find.ByContent<HtmlAnchor>(
"this link"
).ScrollToVisible();
Find.ByContent<HtmlAnchor>(
"this link"
).MouseClick();
if
(ActiveBrowser.BrowserType == BrowserType.InternetExplorer)
{
ArtOfTest.WebAii.BrowserSpecialized.InternetExplorer.InternetExplorerActions ieActions = ((ArtOfTest.WebAii.BrowserSpecialized.InternetExplorer.InternetExplorerActions)(ActiveBrowser.Actions));
ieActions.ConnectIEDialog(
"A Modal Pop-Up -- Webpage Dialog"
, 5000);
}
Manager.WaitForNewBrowserConnect(
"simple.html"
,
true
, 5000);
System.Threading.Thread.Sleep(1000);
Assert.IsTrue(ActiveBrowser.ContainsText(
"This is in a modal dialogue"
));
Log.WriteLine(
"Browser Count: "
+ Manager.Browsers.Count.ToString());
ActiveBrowser.Close();
Log.WriteLine(
"Browser Count: "
+ Manager.Browsers.Count.ToString());
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