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

WaitForNewBrowserConnect: System.TimeoutException

19 Answers 371 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Georg
Top achievements
Rank 1
Georg asked on 07 Sep 2012, 08:03 AM
Hi,

Im trying to assert that a link (you must klick on a image) works. The link opens a new tab and I thought the best assertion for this link is just finding smth in this new window(browser) and close it after..
After openeing the link in a new tab or window im getting following exception:

System.OperationCanceledException : Exception occured waiting for the new browser to connect.
  ----> System.TimeoutException : Wait for condition has timed out
with following code

/// <summary>
/// Tests if clicking the Jira-image opens Jira
/// </summary>
[Test]
public void JiraImgOpensJira()
{      
    Manager.SetNewBrowserTracking(true);
    frame.Find.ById<HtmlImage>("Jira").MouseClick();
 
    Manager.WaitForNewBrowserConnect("https://someLink.de", true, 2000); //EXCEPTION IS AT THIS LINE
    Manager.SetNewBrowserTracking(false);                     
 
    //Assert Jira opened                
    Assert.IsTrue(ActiveBrowser.ContainsText("JiraLogin"));
    ActiveBrowser.Close();          
 
}

first i thought the problem might be the "https" but this code also doesnt work:
(TimeoutException)

[Test]
public void SampleWebAiiTest()
{
    Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
    ActiveBrowser.NavigateTo("http://vvs.de/");
    Find.ById<HtmlDiv>("twitterFCE").MouseClick();
    Manager.SetNewBrowserTracking(true);
    Manager.WaitForNewBrowserConnect("http://twitter.com/VVS#", true, 6000);
    Manager.SetNewBrowserTracking(false);
}

I searched the whole web but everyone is doing the same like in my code.

There are 2 other questions I have:
1. I must interact with at least 1 object/element within my browser that it can detect an iframe --> why?
2. Is Telerik testing Framework compatible to FF 15.0? I am not able to initialize any tests

19 Answers, 1 is accepted

Sort by
0
Chunks
Top achievements
Rank 1
answered on 07 Sep 2012, 09:57 PM
I am running into the same issue with my framework on IE9.
0
Plamen
Telerik team
answered on 12 Sep 2012, 09:59 AM
Hello,

Thank you for providing the sample test. The problem is that the click step that triggers the popup window must be before the SetNewBrowserTracking method. Also, you might need to increase the timeout value specified in the WaitForNewBrowserConnect method. As you can see in this video, the popup connection succeded using the following code:
Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
 
ActiveBrowser.NavigateTo("http://vvs.de/");
 
Manager.SetNewBrowserTracking(true);
 
Find.ById<HtmlDiv>("twitterFCE").MouseClick();
 
Manager.WaitForNewBrowserConnect("http://twitter.com/VVS#", true, 20000);
 
Manager.SetNewBrowserTracking(false);

Looking your original test, and this line:
Manager.WaitForNewBrowserConnect("https://someLink.de", true, 2000);
2 seconds(2000ms) are probably not enough for connection with that popup window. Please increase the timeout value and try again.

I'm not sure what you mean by "I must interact with at least 1 object/element within my browser that it can detect an iframe". When working with frames you need to identify the frame first, then search within it. See here for more information.
 
Regarding the Firefox issue, please ensure that the Telerik Firefox Extension is properly installed and enabled as seen in this article. Also, make note of the statement at the bottom about potentially conflicting Add-ons.

Regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Georg
Top achievements
Rank 1
answered on 18 Sep 2012, 08:37 AM
Hi again,
thank you very much for your response!

Your code works for Chrome. And the Problem for IE was that I forgot to set "Always open popups in a new window". I dont thought that this link counts as a "Popup".
The Problem for FireFox was also the setup.. silly me! (forgot to setup the browsers after formatting)

"I must interact with at least 1 object/element within my browser" means that the Framework cant find an Iframe before clicking a button or smth. in the Mainframe.
Browser frame = browserInWichIsTheIframe.Frames["NameOrIdOfTheIframe"];
works but a nullreferenceexception is thrown after interacting with any object within the iframe. Thats no big problem for me , I just wondered why this is like that and it took me a long time to figure it out.

So thank you again!
0
Plamen
Telerik team
answered on 18 Sep 2012, 09:16 AM
Hi Georg,

You're welcome. I'm glad to hear you got it working. Thanks for the update.

Regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Silvio
Top achievements
Rank 1
answered on 09 Apr 2013, 12:50 PM
Hi,

I´ve got the same problem and can´t solve it.. The timeout is always set to 20 seconds. I´ve got 100 tests without any problem by performing this action, but there are two (same popup, same environment) which fail with an OperationCanceledException.
The timeout doesn´t even take one second before the tests fail.

The following is an example which exactly shows the situation:

var buttonE = container.WaitForElement (new HtmlFindExpression ("tagname=button", "id=?" + controlId), 10000,
                                             false);
new HtmlButton (buttonE).Click();
 
manager.WaitForNewBrowserConnect (windowUrl, true, 20000);

manager.ActiveBrowser.WaitUntilContainsText ("Passwort");
manager.ActiveBrowser.WaitForElement<HtmlInputPassword> ("id="+id).Value = password;

This script works 100 times, but fails two times..
I already tried the following:

var buttonE = container.WaitForElement (new HtmlFindExpression ("tagname=button", "id=?" + controlId), 10000,
                                             false);
manager.SetNewBrowserTracking(true);
new HtmlButton (buttonE).Click();
  
manager.WaitForNewBrowserConnect (windowUrl, true, 20000);
manager.SetNewBrowserTracking(false);

manager.ActiveBrowser.WaitUntilContainsText ("Passwort");
manager.ActiveBrowser.WaitForElement<HtmlInputPassword> ("id="+id).Value = password;

...but also without success.
What could be the reason for this? How can a TimeoutException be thrown before the timeout is over?

Kind regards
Silvio
0
Plamen
Telerik team
answered on 12 Apr 2013, 11:39 AM
Hello Silvio,

I am sorry to hear you are running into this problem. Unfortunately issues like this are extremely difficult to troubleshoot without a local reproduction. Would it be possible for you to provide a sample test that we can run and reproduce the issue? Alternatively you can take a Fiddler trace using FiddlerCap and send it to us in a zip file. Basically with that trace I'll try to "simulate" your app in order to reproduce the issue and investigate what is happening. Thanks for providing the info we need to best assist you.

Regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Silvio
Top achievements
Rank 1
answered on 15 Apr 2013, 02:44 PM
Hi Plamen,

thanks for your answer. I´ll try to find out if I´m allowed to send you a Fiddler Trace tomorrow.

In the meantime this problem blew up. Now this method seems not to work in any of the tests i wrote before. When clicking the closing OK-button of the passsword-window, the whole browser closes down and I get an InvalidOparationException: "This client is not connected to remote to be able to process command."
When I do these steps manually it works, and also when I set two breakpoints (one at the click and one after it).
How can a method stop to work overnight and do such strange things? Neither the application nor the framework was updated or changed.

Edit:
This minute I realized that every single test which tries to connect to a new window and then return to the mainBrowser behaves the same strange way.
0
Plamen
Telerik team
answered on 16 Apr 2013, 02:56 PM
Hi Silvio,

The error: 'This client is not connected to remote to be able to process command', leads me to believe that somehow the browser window was closed prior to attempting the Click action. We'll stand by for a Fiddler trace or sample test against a public app that we can use to reproduce the issue and try to determine what is causing it. 

Kind regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Silvio
Top achievements
Rank 1
answered on 17 Apr 2013, 08:17 AM
Hi Plamen,

the Browser is closing after clicking on the button, and the next operation throws this exception.

There is one more really strange thing:

When I put a Thread.Sleep after the click, it doesn´t work anyway.

button.Click(true);
Thread.Sleep(10000);
browser.WaitForAjax(10000);

When I set a breakpoint on this Thread.Sleep and then press F5 it works.

button.Click(true);
Thread.Sleep(10000);            //<-----------BREAKPOINT
browser.WaitForAjax(10000);

But when I set the breakpoint on the next command it doesn´t work again.

button.Click(true);
Thread.Sleep(10000);
browser.WaitForAjax(10000);            //<-----------BREAKPOINT

I recorded a (long) Fiddler Trace. The important part is the end.

Kind regards
Silvio
0
Ivaylo
Telerik team
answered on 22 Apr 2013, 08:06 AM
Hello Silvio,

Please allow me to interject in this ticket since Plamen is out of the office for the day. 
I have tried to run the fiddler trace attached but without success, could you please provide shorter fiddler trace containing only the problematic area with the pop-up you are experiencing, please make sure the fiddler trace is working on your side before attaching it to the ticket. 

Looking forward to hearing from you and thank you for your cooperation.

Greetings,
Ivaylo
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Silvio
Top achievements
Rank 1
answered on 22 Apr 2013, 09:00 AM
Hi Ivaylo,

thanks for your help!
I recorded 2 new Fiddler Traces and added the .htm files generated by HttpReplay. They are as short as they can be, but nevertheless I needed to navigate to the nearest appearence of a popup in our application.
The first one throws a OperationCanceledException while waiting for the popup (without respecting the set timeout):

System.OperationCanceledException was unhandled by user code
  HResult=-2146233029
  Message=Exception occurred waiting for the new browser to connect.
  Source=ArtOfTest.WebAii
  StackTrace:
       at ArtOfTest.WebAii.Core.Manager.WaitForNewBrowserConnect(String url, Boolean isPartial, Int32 timeout)
       at Telerik_TestProject.Class1.PWPopupTest() in c:\Users\silvio.jeschofnik\Documents\Visual Studio 2012\Projects\Telerik TestProject\Telerik TestProject\Class1.cs:line 133
  InnerException: System.TimeoutException
       HResult=-2146233083
       Message=Wait for condition has timed out
       Source=ArtOfTest.WebAii
       StackTrace:
            at ArtOfTest.Common.WaitSync.CheckResult(WaitSync wait, String extraExceptionInfo, Object target)
            at ArtOfTest.Common.WaitSync.For[T](Predicate`1 predicate, T target, Boolean invertCondition, Int32 timeout, WaitResultType errorResultType)
            at ArtOfTest.Common.WaitSync.For[T](Predicate`1 predicate, T target, Boolean invertCondition, Int32 timeout)
            at ArtOfTest.WebAii.Core.Manager.WaitForNewBrowserConnect(String url, Boolean isPartial, Int32 timeout)
       InnerException:

 and the second one closes the browser when closing the popup and throws following exception at the next action:

ArtOfTest.WebAii.Exceptions.ExecuteCommandException : ExecuteCommand failed!
BrowserCommand (Type:'Action',Info:'NotSet',Action:'Check',Target:'ElementId (tagName: 'input',occurrenceIndex: '20')',Data:'False',ClientId:'Client_0eb06212-64fe-4f04-a5d9-745bbfd97f6e',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'0',InError:'False',Response:'')
InnerException: System.InvalidOperationException: This client 'Client_0eb06212-64fe-4f04-a5d9-745bbfd97f6e' is not connected to remote to be able to process command.
   at ArtOfTest.WebAii.Core.Browser.ExecuteCommandInternal(BrowserCommand request)
 
  ----> System.InvalidOperationException : This client 'Client_0eb06212-64fe-4f04-a5d9-745bbfd97f6e' is not connected to remote to be able to process command.

Edit:
Now I realized, that the same problem also occurs when handling an IE8 or IE9 download dialog (don't know about IE10)..

Kind regards
Silvio
0
Silvio
Top achievements
Rank 1
answered on 22 Apr 2013, 12:53 PM
Could you please remove all the attached files from the posts after you downloaded them? (I thought I could remove them on my own..) Thanks!
0
Ivaylo
Telerik team
answered on 25 Apr 2013, 07:24 AM
Hello Silvio,

Unfortunately the newly provided fiddler traces are not usable, it seems the modification you have made to add the .htm files broke the traces, please provide new fiddler trace but when completed simply archive the .saz file and attach it. If you are not willing to expose your fiddler trace in public you will have to submit a support ticket where the information remains confidential, unlike in the forum post.

All the best,
Ivaylo
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Silvio
Top achievements
Rank 1
answered on 25 Apr 2013, 07:34 AM
Hi,

thanks for your answer.

I did not make any modifications to them, excact of extracting. I can't submit a support ticket because we haven't got a support package yet.

I´ll keep it in mind for future issues, but please remove the attached files anyway.

Kind Regards
Silvio
0
Ivaylo
Telerik team
answered on 26 Apr 2013, 01:39 PM
Hello Silvio,

As per your request the files have been deleted. As I already notices if you would like to submit sensitive information you will have to submit support ticket.

Greetings,
Ivaylo
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Silvio
Top achievements
Rank 1
answered on 29 Apr 2013, 07:46 AM
Hi Ivaylo,

thank you for removing the files. Please also remove the first one.

Unfortunately I realized the kind of data in this files after I submitted it. I mentioned in many posts that I may not submit specific code. So I didn´t suspect fiddler traces to contain any, as you always told me that I could alternatively post it. When I looked at it first, I also didn´t find code, but I haven´t checked all contained files.

We consider purchasing a support package anyway, so I will have to wait for the decision.

Kind Regards
Silvio
0
Plamen
Telerik team
answered on 29 Apr 2013, 08:48 AM
Hi Silvio,

I removed the Fiddler trace attachment as you requested. We'll stand by for further updates from you(in a support ticket). Support tickets are completely confidential, unlike this forum thread.

Regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Silvio
Top achievements
Rank 1
answered on 10 May 2013, 09:27 AM
Hi Plamen,

thank you for your help!

We found the root of this problem:
When clicking the close-button on a popup in our application, the server sends a new site which contains only the javascript which should close the popup. The framework seems not to like this method of closing a popup and closes the main window too.
But I've got no idea why this problem came up over night.

I attached a public test project.

Kind Regards
Silvio


Edit:
I found a workaround: After clicking the close-button I have to quickly remove the popup from the browser-collection
closeBtn.Click(true);
manager.RemoveBrowser(popup.ClientId);
0
Plamen
Telerik team
answered on 13 May 2013, 12:04 PM
Hi Silvio,

I am glad to hear you were able to find a workaround. Thank you for providing a sample test for repro. I was able to reproduce the issue and confirm it as a bug. You can track its progress in our Feedback Portal here: Public URL.

I have also updated your Telerik points accordingly.

Regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Georg
Top achievements
Rank 1
Answers by
Chunks
Top achievements
Rank 1
Plamen
Telerik team
Georg
Top achievements
Rank 1
Silvio
Top achievements
Rank 1
Ivaylo
Telerik team
Share this question
or