Delay in .NavigateTo

9 posts, 0 answers
  1. Jean-Pascal van der Endt
    Jean-Pascal van der Endt avatar
    48 posts
    Member since:
    Jul 2010

    Posted 20 Jul 2011 Link to this post

    Hi guys,

    I have a console app that uses the latest WebAii (2011_1_609) to start IE9 and navigate to a URL. At the same time, I'm using FiddlerCore (Fiddler's class library) to act as a HTTP proxy so I can monitor the traffic. This works quite well.

    However, for some URLs (not all), I’m seeing a delay after the entire page has loaded, i.e. it takes the .NavigateTo method about 5-10 extra seconds after the last HTTP request in the page to observe that the browser has finished loading. During this delay, nothing is happening on the network, and the browser is not loading any other requests. ProcMon shows no activity during this time either (either in IE or my app). On my test server (Win Server 2008 R2) I can reproduce this behavior 100% for certain URLs, when the browser's cache is empty.

    When I disable my FiddlerCore functionality, these delays are not observed. In order to figure out what is actually causing the delay, I'd like to understand more about what WebAii is using in the .NavigateTo method to determine that the browser is "finished". I appreciate any insight in this matter. Thank you very much in advance.

    Regards,
    JP
  2. Jean-Pascal van der Endt
    Jean-Pascal van der Endt avatar
    48 posts
    Member since:
    Jul 2010

    Posted 21 Jul 2011 Link to this post

    I did some more research. If I turn off browser.AutoWaitUntilReady and browser.AutoDomRefresh, the NavigateTo method returns immediately.

    Subsequently, if I call browser.IsReady() in a loop with 100ms intervals, then the first few calls return false (i.e. not ready), and then .IsReady() takes about 7 seconds until it returns true.

    I used JustDecompile (cool tool!) to look at the internals of the IsReady() method, but I can't quite follow it beyond the PipeCommunication.WriteCommandToPipe() function, so I don't know what I can do to figure out what is going on.

    Does anyone have a clue as to what I can do? Thanks for any info.
  3. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 21 Jul 2011 Link to this post

    Hi Jean-Pascal Van Der Endt,

    On the technical side our framework is literally polling the browser asking it if it's in a "Ready" state. This is done via a MSHTML call. The PipeCommunication.WriteCommandToPipe() function you see is our communication path to our hook inside the browser (which is very proprietary) requesting the current state of "isReady". We're watching the same flag that drives IE's busy indicator as seen in the attached screenshot. How does the busy indicator look during this 7 second delay?

    What it means to me is the browser must be doing something internal (running some JavaScript perhaps... maybe making a backend connection to a database or something) that is taking the 7 seconds of time that you have measured. If it is a backend database connection, or internal JavaScript running, this won't get recorded by Fiddler.

    Is there a public website we can access to try and assist you in analyzing what's going on?

    Kind regards,
    Cody
    the Telerik team
    Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

    Have you looked at the new Online User Guide for Telerik Test Studio?
  4. Jean-Pascal van der Endt
    Jean-Pascal van der Endt avatar
    48 posts
    Member since:
    Jul 2010

    Posted 21 Jul 2011 Link to this post

    Hi Cody,

    Thanks for replying, that's really helpful information. I'll run this by the Fiddler team as well, and I'll try to put together a simplified code project in order to reproduce the problem. I'll get back to you. Thanks again!

    Best regards,

    JP
  5. Jean-Pascal van der Endt
    Jean-Pascal van der Endt avatar
    48 posts
    Member since:
    Jul 2010

    Posted 22 Jul 2011 Link to this post

    Hi Cody,

    I have prepared a tiny Visual Studio Console app project that can reproduce the problem using a publicly available website (a website from one of our customers). I prefer sending this information to you by e-mail, if that's okay? Can you let me know how to send it to you?

    Thanks in advance, I hope we can work together in order to find the problem.

    Kind regards,

    JP
  6. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 25 Jul 2011 Link to this post

    Hello Jean-Pascal Van Der Endt,

    Please send it to support@telerik.com. Let me know when it's done and I'll go looking for it on our end.

    Kind regards,
    Cody
    the Telerik team
    Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

    Have you looked at the new Online User Guide for Telerik Test Studio?
  7. Jean-Pascal van der Endt
    Jean-Pascal van der Endt avatar
    48 posts
    Member since:
    Jul 2010

    Posted 26 Jul 2011 Link to this post

    Hello Cody,

    I've sent the email as per your instructions. Thank you for looking into this, I appreciate it.

    Best regards,

    Jean-Pascal
  8. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 26 Jul 2011 Link to this post

    Hello Jean-Pascal Van Der Endt,

    Thank you for the sample project. I do see what you're talking about. I am not certain but I suspect it has something to do with the cache in IE. I found that by putting the test into a loop via this code:

    while (again)
    {
        sw.Reset();
        sw.Start();
        browser.NavigateTo(url);
        sw.Stop();
        Utils.WriteConsoleTimestamp("End NavigateTo");
        Console.WriteLine("Elapsed time for NavigateTo (ms): " + sw.ElapsedMilliseconds.ToString());
        result = "OK";
        Console.WriteLine("Navigate again?");
        string answer = Console.ReadLine().Trim().ToLower();
        again = answer == "y";
    }
    browser.Close();

    After the first time NavigateTo the rest execute at a normal rate. Fiddler must be doing something to IE when it installs its hooks... maybe clearing the IE cache?

    Regards,
    Cody
    the Telerik team
    Check out the Test Studio roadmap to find out more about the new performance testing functionality coming in our R2 2011 release this September!

    Have you looked at the new Online User Guide for Telerik Test Studio?
  9. Jean-Pascal van der Endt
    Jean-Pascal van der Endt avatar
    48 posts
    Member since:
    Jul 2010

    Posted 29 Jul 2011 Link to this post

    Hello Cody,

    Thank you for looking into it so quickly. I needed some time to do more debugging. I've since discovered that the delays are not occurring if I start FiddlerCore in a different process. If I run WebAii and FiddlerCore in separate executables, I'm not seeing the delays. I am not sure why this is so fundamentally different, but I wanted to let you know in case someone else comes asking for it.

    I do have a different, unrelated problem, but I will post that in a separate thread. Thanks again.

    Regards,
    JP
Back to Top