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

Manager.Browsers.Count not Adding/Refreshing

3 Answers 61 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Naveen
Top achievements
Rank 1
Naveen asked on 11 Jun 2013, 09:27 AM
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??

3 Answers, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 12 Jun 2013, 07:35 AM
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
0
Naveen
Top achievements
Rank 1
answered on 12 Jun 2013, 09:19 AM
Thanks for the solution, i had used the code in the way you explained. Test script was failing intermittently
0
Boyan Boev
Telerik team
answered on 12 Jun 2013, 01:26 PM
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
Tags
General Discussions
Asked by
Naveen
Top achievements
Rank 1
Answers by
Boyan Boev
Telerik team
Naveen
Top achievements
Rank 1
Share this question
or