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

Open New Window Continue Recording

5 Answers 321 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 27 Jun 2013, 11:42 AM
How does one open a new window during recording and continue to record in that window? The new window would contain a different site where data is needed to be extracted, the original window will need to stay open and returned to once the data has been extracted from the new window?

5 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 27 Jun 2013, 03:18 PM
Hello Jon,

There is a way to do this, but before I explain those steps, I'm more concerned about test playback. Let's say we go ahead and record steps in two windows. Now we end up with a test with some steps intended for window 1 and some steps intended for window 2. Test Studio doesn't have a built-in mechanism for manually launching a second browser window in order to automate it. What are your plans for test playback to handle this? Unless you implement something to do this the steps intended for window 2 will try to execute in window 1 which obviously are going to fail.

To get a second active recording window follow these simple steps:

  1. Manually launch IE
  2. In Test Studio use the "Attach to Existing Instance" feature

You will now have two active recording browser windows you can use.

Regards,
Cody
Telerik
Free summer webinars on advanced web automation tactics hosted by Jim Holmes & Adam Goucher.
Reserve your seat today!
0
Jon
Top achievements
Rank 1
answered on 27 Jun 2013, 03:28 PM
Does test studio not have a way to distinguish between the two different windows and which ones the steps need to be executed for?
0
Cody
Telerik team
answered on 27 Jun 2013, 04:10 PM
Hi Jon,

Test Studio is designed around the concept of the "Active Browser". All test steps are automatically directed at the Active Browser. Test Studio does not have the concept of "run this step in window A" and "run this step in window B". It will only use the Active Browser.

"Active Browser" is defined as the last window that was opened. When the test starts a browser window is opened and Active Browser points to this window. If a popup opens as the result of some UI action (e.g. clicking a button) Test Studio will automatically connect to it and consider that browser to now be the Active Browser from that point forward. When the popup window closes Active Browser reverts back to the parent window. Thus if you have Parent -> Popup A -> Popup B, as the windows close Active Browser will revert back to Popup A first then Parent when Popup B closes followed by Popup A closing.

If you choose to use code you can have multiple browsers open and direct which window the code will act on. This doesn't work in non-coded steps however. Non-coded steps only use the Active Browser paradigm.

Regards,
Cody
Telerik
Free summer webinars on advanced web automation tactics hosted by Jim Holmes & Adam Goucher.
Reserve your seat today!
0
Jon
Top achievements
Rank 1
answered on 27 Jun 2013, 04:17 PM
Ok thats not too bad, what about spawning the new browser from the test, how would i go about that? Does test studio have a way to call a new browser and go to a URL? Then the tests would run in that active browser then have the browser close once the tests are done in that one and continue on in the old, now active browser.

Basically not sure how to get test studio to open a new IE instance and get the recording start in that new browser whilst having the orginal window open in the background...
0
Cody
Telerik team
answered on 27 Jun 2013, 05:16 PM
Hello,

The only way to cause a new browser window to open (without clicking a button that opens a popup) is via code. This code will launch the default browser type:

Manager.LaunchNewBrowser();

To launch a specific browser type use this syntax:
Manager.LaunchNewBrowser(BrowserType.InternetExplorer, true);
Manager.LaunchNewBrowser(BrowserType.FireFox, true);

Once the browser window is open you can cause it to navigate using either of the following lines of code:

ActiveBrowser.NavigateTo("http://www.telerik.com", false);

- or -

Manager.Browsers[1].NavigateTo("http://www.telerik.com", false);

Or you could take another approach and not launch two browsers. Design your test to work in just one browser. For example, implement the following test steps:

  1. Last step in first web application
  2. Navigate To new URL for new web application
  3. Do some actions
  4. Extract the value
  5. Navigate To the last URL of the previous web application
  6. Use the value extracted above

In this approach everything is done in a single web browser. What you're doing instead is temporarily navigating away from application #1 to application #2, doing some actions in it, then navigating back to application #1 and resuming interacting with it.
Regards,
Cody
Telerik
Free summer webinars on advanced web automation tactics hosted by Jim Holmes & Adam Goucher.
Reserve your seat today!
Tags
General Discussions
Asked by
Jon
Top achievements
Rank 1
Answers by
Cody
Telerik team
Jon
Top achievements
Rank 1
Share this question
or