Manager.Browsers.Count

10 posts, 0 answers
  1. kovyar
    kovyar avatar
    42 posts
    Member since:
    Jul 2010

    Posted 29 Jul 2010 Link to this post

    Hi all.

    Migrating our tests from WebAii 1.1 to WebAii 2.0, I suspect a strange behavior of Manager.Browsers.Count field.

    The problem is that the count of actually opened browser windows is less than Manager.Browsers.Count.
    How we get into this situation: our application opens its main window, then opens a modal window (HTML page, not an alert; Manager.Browsers.Count is now 2),
    then a button on the modal window is pressed, so the window closes. But Manager.Browsers.Count does not become 1, as expected.

    In our tests we usually check the count of the open windows to know whether the report window was successfully closed or not, so this option is vital for us. 

    Thus I wonder if it could be fixed in some way.

    Best regards,
    Yaroslav
  2. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 29 Jul 2010 Link to this post

    Hello kovyar,

    I apologize. This is a known regression we discovered a couple of weeks ago. I came up with a temporary work around you can use until we get the bug fixed in a release.

    const int waitTimeout = 30000;  // timeout after 30 seconds
    const int checkInterval = 200;  // test the condition every 200 milliseconds
    int loopCount = waitTimeout / checkInterval;
    // Save the handle upon entry. We're going to assume it's the popup that's about to close.
    IntPtr hwnd = ActiveBrowser.Window.Handle;
    while (ActiveBrowser.Window.Handle == hwnd && loopCount-- > 0)
    {
        System.Threading.Thread.Sleep(200);
    }
    Assert.AreNotEqual<IntPtr>(ActiveBrowser.Window.Handle, hwnd, "The popup did not close");

    Use this code in place of monitoring the browser count.

    Best wishes,
    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
  3. kovyar
    kovyar avatar
    42 posts
    Member since:
    Jul 2010

    Posted 30 Jul 2010 Link to this post

    HI Cody,

    thanks for the code, I'll use it until the fix in release.
    By the way, when are you going to release it?

    Best regards,
    Yaroslav
  4. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 30 Jul 2010 Link to this post

    Hello kovyar,

    I am sorry I do not have an ETA at this time. It is in the queue to be worked on. Hopefully it won't take too long. I'll update this thread when a build with the fix is available.

    Kind regards,
    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
  5. kovyar
    kovyar avatar
    42 posts
    Member since:
    Jul 2010

    Posted 30 Jul 2010 Link to this post

    Hi Cody.

    That's sad we don't know how much to wait, but your words cause me to hope for the fix.
    As I am subscribed to the thread, I'll know immediately about it.
    Looking forward for the release.

    All the best,
    Yaroslav
  6. kovyar
    kovyar avatar
    42 posts
    Member since:
    Jul 2010

    Posted 07 Sep 2010 Link to this post

    Hi!

    As far as we are planning fixing all the bugs which were discovered while running tests with WeAii 2.0, it would be great for us to know if you have scheduled this bugfix and the approximate date when you are going to have it fixed.

    Sorry for being so annoying, but we need that to schedule our work.

    All the best,
    Yaroslav
  7. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 10 Sep 2010 Link to this post

    Hello kovyar,

    There is no update in regards to this issue yet, I'm sorry. We will get back to you as soon as we have good news.

    Best wishes,
    Konstantin Petkov
    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
  8. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 21 May 2011 Link to this post

    Hello kovyar,

    Although my response got postpone quite a lot, let me update this thread sharing the issue has been recently resolved. If you get to update to the 2011.1 release you need a build 2011.1.520 or later including the fix.

    I'm sorry for the delay and please do let us know if you have feedback regarding the new 2011 R1 version of the framework.

    Regards,
    Konstantin Petkov
    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
  9. Oleg
    Oleg avatar
    1 posts
    Member since:
    Oct 2011

    Posted 15 Nov 2011 Link to this post

    Hello

    I also have a problem with wrong Browsers count. I use Telerik.Testing.Framework.2011.2.1103
    The code I use is below

         var beforeClickBrowsersCount = _browser.Manager.Browsers.Count;
    var anchor = new HtmlDiv(element);
    anchor.MouseClick(MouseClickType.LeftClick);
      var sw = new System.Diagnostics.Stopwatch();
    sw.Start();
    while (sw.ElapsedMilliseconds < timeout) {
    if (_browser.Manager.Browsers.Count > beforeClickBrowsersCount) {
    break;
    }
    System.Threading.Thread.Sleep(2000);
    }
    sw.Stop();

    It clicks on the itemmenu at the page, and after that another new window of browser is created. But browsers count is not changing.  The ActiveBrowser.Window.Handle is also not changing. But if I click the itemmenu by myself during the test, the browsers count is changing like there is some difference between my click and Telerik MouseClick.
  10. Stoich
    Admin
    Stoich avatar
    1 posts

    Posted 21 Nov 2011 Link to this post

    Hello Oleg,
    you're probably experiencing a timing issue.

    What's the timeout set to? I tried to reproduce this issue but I was unable to do so. The Testing Framework clicked worked the same way as a Desktop click. The only thing I was able to establish was that you need to wait a bit after a click in order for the browser count to change. Try adding a fixed delay after the click:
    System.Threading.Thread.Sleep(3000);

    All the best,
    Stoich
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top