public static bool PrintDispatchWithMap() { MouseActions.ClickButton(DispatchProfileWindow.DispatchProfileWindowProperties(), "btnPrintDispatchSheet"); HandleErrorWindow(); DispatchProfileWindow.HandleErrorMessageWindow(); var printWindowControl = PrintOptionsWindowProperties(); //Actions.SelectRadioButton(printWindowControl, "Need Map"); Playback.Wait(5000); MouseActions.ClickButton(printWindowControl, "btnPrint"); var exp = HandleEllisExceptionWindow(); if (exp == null) { HandleErrorWindow(); int i = 0; var print = printWindowControl.Container.SearchFor <WinWindow>(new { Name = "Print" }); //var print1 = print.GetChildren(); //print1[3].SetFocus(); //Playback.Wait(3000); //Mouse.Click(print1[3]); //Playback.Wait(3000); while (print.Exists && i < 10) { print.SetFocus(); SendKeys.SendWait("{ESC}"); Playback.Wait(2000); i++; print = App.Container.SearchFor <WinWindow>(new { Name = "Print" }); } return(true); } return(false); }
public static bool PrintDispatchWithOutMap() { MouseActions.ClickButton(DispatchProfileWindow.DispatchProfileWindowProperties(), "btnPrintDispatchSheet"); var printWindowControl = PrintOptionsWindowProperties(); //Actions.SelectRadioButton() //Actions.SelectRadioButton(printWindowControl, "Do Not Need Map"); Playback.Wait(2000); SendKeys.SendWait(" "); MouseActions.ClickButton(printWindowControl, "btnPrint"); Playback.Wait(5000); var exp = HandleEllisExceptionWindow(); if (exp == null) { int i = 0; var print = App.Container.SearchFor <WinWindow>(new { Name = "Print" }); while (print.Exists && i < 10) { print.SetFocus(); SendKeys.SendWait("{ESC}"); Playback.Wait(2000); i++; print = App.Container.SearchFor <WinWindow>(new { Name = "Print" }); } return(true); } else { Console.WriteLine(exp); MouseActions.ClickButton(printWindowControl, "btnCancel"); return(false); } }
/// <summary> /// If the record we select is not previously authorized, we can't use it for this test's purposes. This function iterates through records until we find one that has previous /// COD authorization. /// </summary> private static bool LookForNonCODWarningRecord() { var tableName = Actions.GetWindowChild(EllisWindow, "grdDispatchJobOrder"); var table = (WinTable)tableName; var rows = table.Rows; //We have to iterate through each Table Row until we find one that isn't Aging or COD for (int i = 0; i < rows.Count; ++i) { //Each row has several elements, we need to find the clickable one foreach (var child in rows[i].GetChildren()) { var cell = child as WinCell; if (cell == null) { continue; } if (cell.BoundingRectangle.Left == cell.BoundingRectangle.Right) { continue; } var clickPoint = new System.Drawing.Point(cell.BoundingRectangle.Left + 3, cell.BoundingRectangle.Top + 3); Mouse.Click(clickPoint); Playback.Wait(200); Mouse.DoubleClick(clickPoint); break; } Playback.Wait(3000); //If the row we clicked on creates a COD window or a Aging window, we dismiss that window, then cancel the Dispatch / Payout window so we can select the next row. if (App.Container.SearchFor <WinWindow>(new { Name = "OrderDetailLanding" }).Exists || App.Container.SearchFor <WinWindow>(new { Name = "Warning" }).Exists) { DispatchProfileWindow.WarningWindowProperties(); Playback.Wait(5000); AutomationElement window = AutomationElement.RootElement.FindFirst(TreeScope.Children, new System.Windows.Automation.PropertyCondition(AutomationElement.NameProperty, "Ellis")); var windows = window.FindAll( TreeScope.Descendants, new System.Windows.Automation.PropertyCondition( AutomationElement.IsWindowPatternAvailableProperty, true)); foreach (AutomationElement w in windows) { if (w.Current.Name.EndsWith("Dispatch / Payout")) { //cancel the dispatch / payout window so we can get back to the Ellis window and select the next row Mouse.Click(w.FindFirst(TreeScope.Descendants, new System.Windows.Automation.PropertyCondition( AutomationElement.AutomationIdProperty, "btnCancel")) .GetClickablePoint()); break; } } } else { return(true); } } return(false); }