Manager.Browsers.Count not Adding/Refreshing

4 posts, 0 answers
  1. Naveen
    Naveen avatar
    4 posts
    Member since:
    Sep 2010

    Posted 11 Jun 2013 Link to this post

    Manager.Browsers.Count is not adding up even though the second browser instance opened up.

    In automation on button click one more browser is opening up but the Browser count is still showing up as 1 instead of 2

    Tried approaches as below

    Manager.SetNewBrowserTracking(true);
    Manager.Wait.For(browsers => Manager.Browsers.Count == 2, Manager.Browsers.Count, 100000);


    Also tried with WaitUntilReady() , but still Browser count shows up as 1..

    Any inputs??

  2. Boyan Boev
    Admin
    Boyan Boev avatar
    1045 posts

    Posted 12 Jun 2013 Link to this post

    Hi Naveen,

    Thank you for contacting us.

    Test Studio should connect to the new browser after that the count will change. The code should look like:

    //Turn on new browser tracking before the popup link is clicked
    Manager.SetNewBrowserTracking(true);
    //Trigger the new browser
    Find.ByTagIndex<HtmlAnchor>("a", 58).Click();
    //Connect to the new browser
    Manager.WaitForNewBrowserConnect("http://theUrl.com", true, 5000);

    See below for complete sample code against a public site with a popup child window:

     
    //Turn on new browser tracking before the popup link is clicked
    Manager.SetNewBrowserTracking(true);
     
    Find.ByTagIndex<HtmlAnchor>("a", 58).Click();
    Manager.WaitForNewBrowserConnect("http://www.htmlcodetutorial.com/linking/popup_test_a.html", true, 5000);
     
    Log.WriteLine(Manager.Browsers.Count.ToString());
     
    //You can now turn off new browser tracking
    Manager.SetNewBrowserTracking(false);
     
    //Check whether the ActiveBrowser is now the popup.
    Assert.IsTrue(ActiveBrowser.Url.Contains("http://www.htmlcodetutorial.com/linking/popup_test_a.html"));

    I recorded a short video, which demonstrates it.

    Hope this helps.

    Regards,
    Boyan Boev
    Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. Naveen
    Naveen avatar
    4 posts
    Member since:
    Sep 2010

    Posted 12 Jun 2013 Link to this post

    Thanks for the solution, i had used the code in the way you explained. Test script was failing intermittently
  4. Boyan Boev
    Admin
    Boyan Boev avatar
    1045 posts

    Posted 12 Jun 2013 Link to this post

    Hi Naveen,

    In order to assist you best please elaborate a bit more on your scenario. 

    1. What do you mean by "Test script was failing intermittently".

    2. Please send us the trace log.

    3. A Jing video demonstrating the issue may also help us to better understand what is happening.

    4. If you continue to have difficulty, we'll need to reproduce the issue locally in order to investigate what is happening and find a workable solution for you. Please provide us with a copy of your test and access to your application. If it is not possible to grant us access to your application, please take a Fiddler trace using FiddlerCap and send it to us in a zip file.

    Hope to hear from you soon.

    Regards,
    Boyan Boev
    Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top