Connect and Close Popup Steps
Detecting popups opened in new window is an out-of-the-box feature in Test Studio. The steps recorded for connecting to and closing the popups provide various properties to fine tune the execution. The steps to connect to a popup and then close it, can be added also manually in the test.
In this article you can find useful information about:
- Add manually a step to connect to/close popup
- Connect to/Close popup steps timeouts
- Popup URL properties in the connect to/close popup steps
- How to connect to popup with dynamic URL?
- What are modal popups and how Test Studio handles these?
Add a Connect/Close Popup Step Manually
Even if you work on the tests in the project and have no active recording session, you can still add the specific steps to connect to and close a popup from the Step Builder. These steps are listed under the General section of the Step Builder, under Dialogs. Select one of the Connect/Close popup window step and add hit the Add Step button.
Properties for Connect/Close Popup Steps
The various properties allows you to fine tune the steps to connect and close popups in the automated application.
Timeouts
The properties related to timing are the PopupWaitTimeout - this controls the time, which the test retries to connect to the popup until successful, and the InitializationTime - it controls the time, which the test waits before it starts searching for such dialog (applicable for IE browser only). It is useful to increase this, if the popup window/tab requires longer time to popup.
Popup URL
Test Studio recognizes the new popup windows by their URLs and records the current URL into the PopupUrl step property.
Note
If the parent and popup window share the same URL, Test Studio cannot tell the difference between them. Thus, during execution Test Studio will randomly connect to one of them and this cannot be controlled.
Popups with Dynamic URL
Test Studio allows you to use only part of the URL of a popup window. In the cases when the tested web application typically loads popups with URLs that contain a dynamic portion, such as a search query, you can use the IsUrlPartial step property to alter the settings of how the popup is matched.
For example:
- Your Popup URL contains a dynamic query: http://www.domain.com/search?1234567890
- Set IsUrlPartial to True.
- Set PopupUrl to: http://www.domain.com/search
Modal Popups
A Modal popup window is a child window that requires users to interact with it before they can return to operating the parent application. Modal windows often have a different appearance than normal windows and are typically without navigation buttons and menu headings.
Test Studio detects automatically also this type of popups, but due to their specific behavior, there is no additional recorder loaded for these modal windows. They are recognized in Test Studio by their modal caption. For them the Connect to/Close pop-up window steps can be modified to use the properties IsModalPopup, which transforms the step to search for modal window, and the ModalPopupPartialCaption, which holds the modal window caption name (can use partial caption).
Note
Test Studio cannot connect to modal popup windows which do not have a title in Firefox, Safari, and Chrome. To avoid any troubles in automating the tested page in browsers other than Internet Explorer, ensure any modal popups are titled.