Close a pop-up window in Chrome during a test
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Close a pop-up window in Chrome during a test
Hi,
I am running a test and I am getting the security alert pop-up window.
I am getting this window only on production site and not when recording the test locally.
I am new to TestComplete and not sure how to close this window during the test. Please help.
I have seen in other threads that we can use If Object, but since I am not getting this popup when recording the test, I cannot drag and drop for the object.
Thanks.
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could run TC on your production environment to just record a test that will click the button you need. That will give you the objects and then you can use them in your test however you like.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We use this to close unexpected windows "Leave This Page?"
The first one is is run as an event handler from event OnWebBeforeNavigate.
function Test_Complete_Test_Run_Events_OnWebBeforeNavigate(Sender, WebBrowser, URL)
{
// Check for the presence of the "Leave This Page?" popup
Close_Leave_Site_popup();
}
function Close_Leave_Site_popup()
{
var Max_Wait_Time_ms = 500;
// Check for Edge unexpected window...
if(Aliases.browser.Application_Main_Page.Browser_Leave_Site_popup.Leave_button.WaitProperty("Exists", true, Max_Wait_Time_ms) == true)
{
Aliases.browser.Application_Main_Page.Browser_Leave_Site_popup.Leave_button.Click();
Log.Message("MS Edge: UNEXPECTED WINDOW closed");
}
// Check for IE unexpected window...
if(Aliases.browser_IE.Application_Main_Page.Browser_Confirm_popup.Leave_This_Page_button.WaitProperty("Exists", true, Max_Wait_Time_ms) == true)
{
Aliases.browser_IE.Application_Main_Page.Browser_Confirm_popup.Leave_This_Page_button.Click();
Log.Message("IE: UNEXPECTED WINDOW closed");
}
}
And as @AmulyaT said you can obtain the mapping by recording or spying the window and mapping it manually or using a suitable template.
We also get Java popups which we clear using a simple "close" or refreshing the page.
