Reference the ArtOfTest.WebAii.Win32.Dialogs.dll in the project and insert it as using in the code file.
// Define the Alert dialog and how it needs to be handled - choose between Ok and Cancel var alertDlg = new ArtOfTest.WebAii.Win32.Dialogs.AlertDialog(Manager.ActiveBrowser, DialogButton.CANCEL); // The dialog monitor is the Testing Framework built-in class for monitoring the dialogs to be handled throughout the test // Add the defined alert dialog alertDlg to the DialogMonitor collection and start it Manager.DialogMonitor.AddDialog(alertDlg); Manager.DialogMonitor.Start(); // At this point when the dialog definition is added to the DialogMonitor // and it is started you can insert the action, // which triggers the alert dialog // This is the action that invokes the dialog for this specific example // The next four lines need to be replaced for the specific application under test ActiveBrowser.Window.SetFocus(); Pages.DialogsTestingPage.AlertButtonButtonTag.ScrollToVisible(ArtOfTest.WebAii.Core.ScrollToVisibleType.ElementCenterAtWindowCenter); Pages.DialogsTestingPage.AlertButtonButtonTag.MouseClick(); // Here we wait for the dialog to be handled eiether specify or Settings.Current.ClientReadyTimeout will be used by default // Wait for the dialog to appear and to be handled. The WaitUntilHandled() method accepts miliseconds to define the time to wait. If no value is defined, the Settings.Current.ClientReadyTimeout is in use alertDlg.WaitUntilHandled(); // The dialog gets automatically handled once it appears. // Remove the handled dialog from the DialogMonitor collection and stop the monitoring Manager.DialogMonitor.RemoveDialog(alertDlg); Manager.DialogMonitor.Stop(); // Optionally, you might need to refresh the DOM used from Test Studio after the dialog was handled // The code to use for this is on the below line and will be necessary if you experience any issues with the next actions // especially if the elements to use are related to the action confirmed with the dialog handling //Manager.ActiveBrowser.RefreshDomTree();