Window1 opens Window2 which opens Window3
W1 - W2 - W3
After I close Window3 Telerik doesn't "see" Window2.
I have following test steps:
1. Opening W1
// Connect to pop-up window : '/Site/main.aspx?'
Manager.WaitForNewBrowserConnect("/Site/main.aspx?", true, 5000);
Manager.ActiveBrowser.WaitUntilReady();
ActiveBrowser.Window.SetFocus();
// Connect to modal pop-up window : Look Up Records -- Webpage Dialog
if ((ActiveBrowser.BrowserType == BrowserType.InternetExplorer))
{
ArtOfTest.WebAii.BrowserSpecialized.InternetExplorer.InternetExplorerActions ieActions = ((ArtOfTest.WebAii.BrowserSpecialized.InternetExplorer.InternetExplorerActions)(ActiveBrowser.Actions));
ieActions.ConnectIEDialog("Look Up Records -- Webpage Dialog", 5000);
}
Manager.WaitForNewBrowserConnect("/Site/_controls/lookup/lookupinfo.aspx?LookupStyle=multi&browse=0&objecttypes" +
"=4300", true, 5000);
Manager.ActiveBrowser.WaitUntilReady();
// Connect to modal pop-up window : Add Marketing Lists to Campaign -- Webpage Dialog
if ((ActiveBrowser.BrowserType == BrowserType.InternetExplorer))
{
ArtOfTest.WebAii.BrowserSpecialized.InternetExplorer.InternetExplorerActions ieActions = ((ArtOfTest.WebAii.BrowserSpecialized.InternetExplorer.InternetExplorerActions)(ActiveBrowser.Actions));
ieActions.ConnectIEDialog("Add Marketing Lists to Campaign -- Webpage Dialog", 5000);
}
Manager.WaitForNewBrowserConnect("/Sitecore/_controls/lookup/lookupinfo.aspx?LookupStyle=multi&browse=0&objecttypes" +
"=4300", true, 5000);
Manager.ActiveBrowser.WaitUntilReady();
ActiveBrowser.Window.SetFocus();
// Close modal pop-up window : Add Marketing Lists to Campaign -- Webpage Dialog
ActiveBrowser.Close();
After closing W3 Window2 get focus but Telerik lost it and can't do following steps.
How I could get my test working?
11 Answers, 1 is accepted
Problem is that Telerik doesn't switch to W2 and DOM has content from W3.
InError
set
by the client. Client Error:
System.ArgumentNullException: Value cannot be
null
.
Parameter name: SetCurrentDocumentMarkup. The document
object
is
null
. Unable to
get
markup. Probably the Html Document was closed prior to executing the action.
Any solutions?
It's unclear how all your code fits together. I suspect it isn't organized correctly. Here's sample code that worked for me where a parent page (W1) opens Modal1 (W2), and then Modal2 is opened (W3) from W2:
[TestMethod]
public
void
ModalPopup2()
{
Manager.LaunchNewBrowser();
ActiveBrowser.NavigateTo(
"c:\\html\\modal.html"
);
Manager.SetNewBrowserTracking(
true
);
Find.ByContent<HtmlButton>(
"Show Modal Example"
).MouseClick();
//load Modal1
if
(ActiveBrowser.BrowserType == BrowserType.InternetExplorer)
{
ArtOfTest.WebAii.BrowserSpecialized.InternetExplorer.InternetExplorerActions ieActions = ((ArtOfTest.WebAii.BrowserSpecialized.InternetExplorer.InternetExplorerActions)(ActiveBrowser.Actions));
ieActions.ConnectIEDialog(
"Modal1 -- Webpage Dialog"
, 5000);
Manager.WaitForNewBrowserConnect(
"codefrog.html"
,
true
, 5000);
Assert.IsTrue(ActiveBrowser.IsIEDialog);
Find.ByContent<HtmlButton>(
"Show Modal Example2"
).MouseClick();
//Load Modal2 from Modal1
if
(ActiveBrowser.BrowserType == BrowserType.InternetExplorer)
//second IF nested inside first IF
{
ArtOfTest.WebAii.BrowserSpecialized.InternetExplorer.InternetExplorerActions ieActions2 = ((ArtOfTest.WebAii.BrowserSpecialized.InternetExplorer.InternetExplorerActions)(ActiveBrowser.Actions));
ieActions2.ConnectIEDialog(
"Modal2 -- Webpage Dialog"
, 5000);
//Give second ieActions2 variable unique name
Manager.WaitForNewBrowserConnect(
"comma.html"
,
true
, 5000);
Assert.IsTrue(ActiveBrowser.IsIEDialog);
ActiveBrowser.Close();
//Close Modal2
}
Find.ByAttributes<HtmlAnchor>(
"href=http://www.bing.com"
).Click(); //Click a link unique to Modal1 to prove it
is
current ActiveBrowser, then close it
ActiveBrowser.Close();
}
}
Anthony
the Telerik team
My code is auto-generated by Telerik.
Now I'm struggling with 3 window handling if test is generated by recorder. I hope "Find" will help me, but it very strange why this functionality doesn't work out-of-box.
http://screencast.com/t/_4v0YkyWgSS_
Thank you for the screen recording. It clarifies your scenario that you're using standard steps through the Standalone version's UI and not crafting entirely in code as I initially thought.
Step 31 is trying to connect to an HTML Popup with a partial URL of:
- /Sitecore/main.aspx?
This matches that popup's URL when it is first launched. However, the video indicates that after its content loads, the URL changes to:
- https://vs4crm2011.crm5test.sitecore.net/?etc=...
I suspect that during Test Execution there isn't enough time for Test Studio to connect to the popup before its URL changes. Try changing the PopUrl for step 31 to contain a partial match for the second URL.
Kind regards,
Anthony
the Telerik team
Also why Telerik handle URL such way if window have another URL?
And how can I determine URL of window instead of view its header directly?
When you recorded the test and initially loaded the popup it contained URL1, so that's what Test Studio recorded. The Connect to popup window step was then in place with URL1, and it's not going to automatically update when the popup redirects to URL2. That's why that step required a manual change.
Your last question is best asked to your developers. I'm sure your app's code contains the URL information. As a tester, it's probably easiest to visually verify via the window's header, as we've just experienced.
Anthony
the Telerik team
http://screencast.com/t/jNKr0Vq2Pr
I have focus on window, try to close it by partial URL
http://screencast.com/t/lHGjzYm5
but test step is failed with
Cannot find Browser host with Url: '?etc=4212&extraqs='.
Attempted to close Browser: 'https://vs4crm2011.crm5test.sitecore.net/Sitecore/Activities/act_dlgs/convert_activity.aspx?activityType=4212&;ownerId=%7b2741E56C-363A-DF11-9A3A-00155D28151F%7d&ownerType=8&subject=call%20gage
Why I can't close browser?
It seems the Close modal pop-up window step was either not recorded or removed. This is why the focus has remained on the modal and not back to the HTML popup.
The issue is with step 14 that clicks the Cancel button. This actually closes the Modal window. Normally setting this step's ClosesBrowser property to True will handle this situation. However I reproduced this scenario with local files where this doesn't work as expected. The focus remains on the Modal window and thus the HTML popup cannot be found and closed. I logged a bug report on this. You can find the PITS Issue here: Public URL.
In the meantime, try disabling the "Click Button_Cancel" step and putting a Close modal pop-up window: Convert Task To Opportunity -- Webpage Dialog step in its place.
Anthony
the Telerik team
But how I should do if I need to press OK and window will be closed? Set "ClosesBrowser property to True" doesn't help.
That's the exact issue I filed the bug for. Setting ClosesBrowser to True should work in this scenario, but it doesn't. We'll strive to fix that bug soon.
Regards,Anthony
the Telerik team