ClosePopup - web automation method

Closes a window.alert or a window.confirm popup window in Internet Explorer instance represented by the Browser web automation library object.

Applies to:
  var text = browserObj.ClosePopup("popup_text", "button");
If popup_text parameter is emtpy then any window.alert / window.confirm popup window will be closed. This web automation method returns the text displayed by the pop-up window. The time allocated for searching the popup is specified by the searchTimeout property. The method throws a web macro exception if the popup or the button is not found. In this case the lastError property of the Core object is set to FAIL_ERROR.
var core    = new ActiveXObject("OpenTwebst.Core");
var browser = core.StartBrowser("");

// Use hardware events otherwise Click will be blocked until the popup is close!

core.useHardwareInputEvents = true;
browser.FindElement("input button", "text=Alert").Click();
browser.ClosePopup("Alert text", "OK");
See also:
asyncHtmlEvents | Browser | Close | closeBrowserPopups | ClosePrompt | FindModalHtmlDialog | FindModelessHtmlDialog

© 2017 CodeCentrix Software. All rights reserved.