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

WaitForNewBrowserConnect Always fails

3 Answers 135 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Arsalan
Top achievements
Rank 1
Arsalan asked on 26 Oct 2010, 12:20 PM
I am trying to open a new window by clicking on a hyperlink but the code always fails at Waitfornewbrowerconnect(URL,Ispartial, Timeout). I mean it always times out. There are two pieces of code given below both gets stuck at Waitfornewbrowerconnect(URL,Ispartial, Timeout) in both IE or FF. I am using following configurations:

- MS Visual studio express edition 2010
- Gallio 3.2
-Windows 7

My browser settings are exactly as given in the documentation. Any ideas?



Code 1
*****************************************************************************************************************
 Manager.Settings.AnnotateExecution = true;

            Manager.LaunchNewBrowser(BrowserType.InternetExplorer,true);
            Manager.DialogMonitor.AddDialog(new LogonDialog(ActiveBrowser, "login", "password", DialogButton.OK));
            Manager.DialogMonitor.Start();
          ActiveBrowser.NavigateTo("http://localhost:4444/Location/NewForm.aspx?RootFolder=%2FLocation&Source=http%3A%2F%2Ftest.kuoni.com%2FLocation%2FAllItems.aspx");
     ActiveBrowser.WaitUntilReady();
     Manager.SetNewBrowserTracking(true);
     Find.ById<HtmlAnchor>("ID").Click();
     
     if (ActiveBrowser.BrowserType == BrowserType.InternetExplorer)
     {
         InternetExplorerActions ieActions = (InternetExplorerActions)ActiveBrowser.Actions;
           ieActions.ConnectIEDialog("l:Edit Hyperlink Properties", 300);
         Manager.WaitForNewBrowserConnect("http:/localhost:4444/_layouts/AssetEditHyperLink.aspx?DefaultAssetLocation=&DefaultAssetImageLocation=&DisplayLookInSection=true&DefaultToLastUsedLocation=true&ManageHyperlink=true&DisplayWidth=&DisplayHeight=&AllowExternalUrls=true&OverrideDialogImageUrl=&OverrideDialogTitle=&ManageLinkDisplayText=true&ManageLinkIcon=true&IconUrl=", false, 3000);
         Assert.IsTrue(ActiveBrowser.IsIEDialog);

        
         ActiveBrowser.Close();
     }
     Manager.WaitForNewBrowserConnect("http://localhost:4444/_layouts/AssetEditHyperLink.aspx?DefaultAssetLocation=&DefaultAssetImageLocation=&DisplayLookInSection=true&DefaultToLastUsedLocation=true&ManageHyperlink=true&DisplayWidth=&DisplayHeight=&AllowExternalUrls=true&OverrideDialogImageUrl=&OverrideDialogTitle=&ManageLinkDisplayText=true&ManageLinkIcon=true&IconUrl=", false, 3000);
     Assert.AreEqual("Edit Hyperlink Properties", ActiveBrowser.PageTitle);
ActiveBrowser.Close();


******************************************


Code 2
*****************************************************************************************************
 Manager.Settings.AnnotateExecution = true;

            Manager.LaunchNewBrowser(BrowserType.InternetExplorer,true);
            Manager.DialogMonitor.AddDialog(new LogonDialog(ActiveBrowser, "login", "password", DialogButton.OK));
            Manager.DialogMonitor.Start();
          ActiveBrowser.NavigateTo("http://localhost:4444/Location/NewForm.aspx?RootFolder=%2FLocation&Source=http%3A%2F%2Ftest.kuoni.com%2FLocation%2FAllItems.aspx");
     ActiveBrowser.WaitUntilReady();
     Manager.SetNewBrowserTracking(true);
     Find.ById<HtmlAnchor>("ID").Click();
     
       Manager.WaitForNewBrowserConnect("http://localhost:4444/_layouts/AssetEditHyperLink.aspx?DefaultAssetLocation=&DefaultAssetImageLocation=&DisplayLookInSection=true&DefaultToLastUsedLocation=true&ManageHyperlink=true&DisplayWidth=&DisplayHeight=&AllowExternalUrls=true&OverrideDialogImageUrl=&OverrideDialogTitle=&ManageLinkDisplayText=true&ManageLinkIcon=true&IconUrl=", false, 3000);
     Assert.AreEqual("Edit Hyperlink Properties", ActiveBrowser.PageTitle);
ActiveBrowser.Close();

3 Answers, 1 is accepted

Sort by
0
Keaegan
Telerik team
answered on 26 Oct 2010, 09:05 PM
Hello Arsalan,

Having timeout issues is never a good thing, and I'm sorry to hear you are having them with your current testing setup. This error message is usually generated by our software for one of the following two reasons:
  1. The target url you are specifying is incorrect/mis-typed
  2. The test is setup to expect a new browser window, is not receiving one, and is timing out while waiting for it.

To see if it is the first option, try having the test go to a known good site for the step instead of your internal site. If you get the same error, that means that it is most likely the second of the above listed issues. If you get no error and it proceeds, your target url should be modified to remove the timeout error.

If, however, you get the same error when targeting a "Known Good" URL, this most likely means that there is a syntax error in the previous code you have setup.

Please let us know if you have further inquiry on this.

Greetings,

Keaegan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Arsalan
Top achievements
Rank 1
answered on 27 Oct 2010, 08:19 AM
Ok.. i just found out the code works for another URL... thank you very much. Actually it was a modal dialog and so it should be handled like modal dialog should be handled.  Ok, now can you tell me something :
 ieActions.ConnectIEDialog("Edit hyperlink properties", 300);

"Edit hyperlink properties" is the caption of modal as written in the documentation here http://www.artoftest.com/support/webaii/topicsindex.aspx but the code always fails at this line of code now. It says it cannot find a modal dialog with caption "Edit hyperlink properties" ( this is the title of my dialog box). I am now confused whether there is a difference between caption and title ? may be that is why code fails here. But i can see no difference between the two. Perhaps you can explain?
0
Accepted
Cody
Telerik team
answered on 27 Oct 2010, 04:09 PM
Hello Arsalan,

The problem is that you must use MouseClick() instead of .Click() to open your modal dialog as the documentation you have pointed to states:

// Open the popup using mouse click so it doesn't hang execution.
Find.ByAttributes<HtmlInputButton>("type=button").MouseClick();

The regular .Click() method never returns until the modal dialog is closed.

All the best,
Cody
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Arsalan
Top achievements
Rank 1
Answers by
Keaegan
Telerik team
Arsalan
Top achievements
Rank 1
Cody
Telerik team
Share this question
or