private void ClickGDIControl_ClickApplyButton_HandleOverrideDialog() { Button ApplyButton; Point pointX; int track = 353; do { //scheduling window doesn't contain named controls, so mouse clicks pointX = new Point(track, 606); windowTools.MouseDoubleClickPoint(window, pointX); ApplyButton = windowTools.GetButton(window, "Apply Changes"); track += 8; } while (!ApplyButton.Enabled); ApplyButton.DoubleClick(); int winCount = application.GetWindows().Count; var dialogBox = windowTools.GetFirstDescendant(AutomationElement.RootElement, (e) => e.Name == "CBI" && e.ClassName == "#32770"); if (dialogBox != null) { var button = windowTools.GetFirstDescendant(dialogBox, (e) => e.Name.Contains("Yes") && e.ClassName.Contains("Button")); Assert.IsNotNull(button); var caption = windowTools.GetFirstDescendant(dialogBox, (e) => e.Name.Contains("Do you wish to attempt to override availability")); ((InvokePattern)button.GetCurrentPattern(InvokePattern.Pattern)).Invoke(); } }