WaitForNewBrowserConnect: System.TimeoutException

20 posts, 0 answers
  1. Georg
    Georg avatar
    2 posts
    Member since:
    Aug 2012

    Posted 07 Sep 2012 Link to this post

    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
  2. Chunks
    Chunks avatar
    17 posts
    Member since:
    Nov 2011

    Posted 07 Sep 2012 Link to this post

    I am running into the same issue with my framework on IE9.
  3. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 12 Sep 2012 Link to this post

    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
  4. Georg
    Georg avatar
    2 posts
    Member since:
    Aug 2012

    Posted 18 Sep 2012 Link to this post

    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!
  5. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 18 Sep 2012 Link to this post

    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
  6. Silvio
    Silvio avatar
    52 posts
    Member since:
    Dec 2012

    Posted 09 Apr 2013 Link to this post

    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
  7. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 12 Apr 2013 Link to this post

    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
  8. Silvio
    Silvio avatar
    52 posts
    Member since:
    Dec 2012

    Posted 15 Apr 2013 Link to this post

    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.
  9. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 16 Apr 2013 Link to this post

    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
  10. Silvio
    Silvio avatar
    52 posts
    Member since:
    Dec 2012

    Posted 17 Apr 2013 Link to this post

    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
  11. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 22 Apr 2013 Link to this post

    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
  12. Silvio
    Silvio avatar
    52 posts
    Member since:
    Dec 2012

    Posted 22 Apr 2013 Link to this post

    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
  13. Silvio
    Silvio avatar
    52 posts
    Member since:
    Dec 2012

    Posted 22 Apr 2013 Link to this post

    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!
  14. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 25 Apr 2013 Link to this post

    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
  15. Silvio
    Silvio avatar
    52 posts
    Member since:
    Dec 2012

    Posted 25 Apr 2013 Link to this post

    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
  16. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 26 Apr 2013 Link to this post

    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
  17. Silvio
    Silvio avatar
    52 posts
    Member since:
    Dec 2012

    Posted 29 Apr 2013 Link to this post

    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
  18. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 29 Apr 2013 Link to this post

    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
  19. Silvio
    Silvio avatar
    52 posts
    Member since:
    Dec 2012

    Posted 10 May 2013 Link to this post

    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);
  20. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 13 May 2013 Link to this post

    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
Back to Top