private void HandleWindowsWidgetTableControlAction(ActTableElement actWWC) { HtmlAgilityPack.HtmlNode WinWidEle = mUIAutomationHelper.GetHTMLHelper().GetActNode(actWWC); if (WinWidEle == null) { actWWC.Error = "Element not Found - " + actWWC.LocateBy + " " + actWWC.LocateValueCalculated; return; } mUIAutomationHelper.GetHTMLHelper().HandleWidgetTableControlAction(actWWC, WinWidEle); }
private void SetComponents() { ColName.ItemsSource = mColNames; for (int i = 0; i <= mRowCount; i++) { Row.Items.Add(i.ToString()); } ActTableElement ACJT = new ActTableElement(); App.FillComboFromEnumVal(RunActionOn, ACJT.RunActionOn); }
public ActTableEditPage(ElementInfo ElementInfo, ObservableList <Act> Actions, ActTableElement Act = null) { eBaseWindow = BaseWindow.WindowExplorer; mAct = new ActTableElement(); mElementInfo = ElementInfo; mActions = Actions; ShowCellActions(); InitializeComponent(); InitTableInfo(); SetComponents(); SetDescriptionDetails(); }
private void SetComponents() { ControlActionComboBox.Visibility = Visibility.Collapsed; ControlActionComboBox.Visibility = Visibility.Collapsed; OperationTypeRow.Height = new GridLength(0); cmbColumnValue.Items.Clear(); WhereColumnTitle.Items.Clear(); for (int i = 0; i < mColNames.Count; i++) { cmbColumnValue.Items.Add(mColNames[i].ToString()); WhereColumnTitle.Items.Add(mColNames[i].ToString()); } cmbColumnValue.SelectedIndex = 0; WhereColumnTitle.SelectedIndex = 0; for (int i = 0; i < mRowCount; i++) { RowSelectorValue.Items.Add(i.ToString()); } RowSelectorValue.SelectedIndex = 0; ActTableElement ACJT = new ActTableElement(); GingerCore.General.FillComboFromEnumObj(cmbColSelectorValue, ACJT.ColSelectorValue); if (cmbColSelectorValue.SelectedIndex == -1) { cmbColSelectorValue.SelectedIndex = 0; } GingerCore.General.FillComboFromEnumObj(WhereColumn, ACJT.ColSelectorValue); if (WhereColumn.SelectedIndex == -1) { WhereColumn.SelectedIndex = 0; } GingerCore.General.FillComboFromEnumObj(WhereProperty, ACJT.WhereProperty); if (WhereProperty.SelectedIndex == -1) { WhereProperty.SelectedIndex = 0; } GingerCore.General.FillComboFromEnumObj(WhereOperator, ACJT.WhereOperator); if (WhereOperator.SelectedIndex == -1) { WhereOperator.SelectedIndex = 0; } WherePanel.Visibility = Visibility.Collapsed; WhereDataRow.Height = new GridLength(0); WhereColumnValue.Init(Context.GetAsContext(mAct.Context), ACJT.GetOrCreateInputParam(ActTableElement.Fields.WhereColumnValue)); }
public ActTableEditPage(ActTableElement Act = null) { eBaseWindow = BaseWindow.ActEditPage; mAct = Act; InitializeComponent(); GingerCore.General.FillComboFromEnumObj(cmbColSelectorValue, mAct.ColSelectorValue); GingerCore.General.FillComboFromEnumObj(WhereColumn, mAct.ColSelectorValue); GingerCore.General.FillComboFromEnumObj(WhereProperty, mAct.WhereProperty); GingerCore.General.FillComboFromEnumObj(WhereOperator, mAct.WhereOperator); GingerCore.General.FillComboFromEnumObj(ControlActionComboBox, mAct.ControlAction); SetDescriptionDetails(); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(cmbColSelectorValue, ComboBox.SelectedValueProperty, mAct, ActTableElement.Fields.ColSelectorValue); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(cmbColumnValue, ComboBox.TextProperty, mAct, ActTableElement.Fields.LocateColTitle); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(RowNum, CheckBox.IsCheckedProperty, mAct, ActTableElement.Fields.ByRowNum); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(AnyRow, CheckBox.IsCheckedProperty, mAct, ActTableElement.Fields.ByRandRow); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(BySelectedRow, CheckBox.IsCheckedProperty, mAct, ActTableElement.Fields.BySelectedRow); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(Where, CheckBox.IsCheckedProperty, mAct, ActTableElement.Fields.ByWhere); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(RowSelectorValue, ComboBox.TextProperty, mAct, ActTableElement.Fields.LocateRowValue); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(WhereColumn, ComboBox.SelectedValueProperty, mAct, ActTableElement.Fields.WhereColSelector); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(WhereColumnTitle, ComboBox.TextProperty, mAct, ActTableElement.Fields.WhereColumnTitle); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(WhereProperty, ComboBox.SelectedValueProperty, mAct, ActTableElement.Fields.WhereProperty); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(WhereOperator, ComboBox.SelectedValueProperty, mAct, ActTableElement.Fields.WhereOperator); WhereColumnValue.Init(Context.GetAsContext(mAct.Context), mAct.GetOrCreateInputParam(ActTableElement.Fields.WhereColumnValue)); GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(ControlActionComboBox, ComboBox.SelectedValueProperty, mAct, ActTableElement.Fields.ControlAction); if (WhereColumn.SelectedIndex == -1) { WhereColumn.SelectedIndex = 0; } if (cmbColSelectorValue.SelectedIndex == -1) { cmbColSelectorValue.SelectedIndex = 0; } if (WhereProperty.SelectedIndex == -1) { WhereProperty.SelectedIndex = 0; } if (WhereOperator.SelectedIndex == -1) { WhereOperator.SelectedIndex = 0; } }
public override void RunAction(Act act) { //TODO: add func to Act + Enum for switch string actClass = act.GetType().ToString(); mUIAutomationHelper.mLoadTimeOut = mActionTimeout; mUIAutomationHelper.taskFinished = false; //TODO: avoid hard coded string... actClass = actClass.Replace("GingerCore.Actions.", ""); actClass = actClass.Replace("Windows.", ""); if (actClass != "ActSwitchWindow" || (actClass == "ActWindow" && ((ActWindow)act).WindowActionType != ActWindow.eWindowActionType.Switch)) { CheckRetrySwitchWindowIsNeeded(); } if (act.Timeout != null) { mUIAutomationHelper.mLoadTimeOut = act.Timeout; } try { switch (actClass) { case "ActWindow": ActWindow actWindow = (ActWindow)act; HandleWindowAction(actWindow); break; //TODO: ActSwitchWindow is the correct approach for switch window. And we should guide the users accordingly. case "ActSwitchWindow": mUIAutomationHelper.SmartSwitchWindow((ActSwitchWindow)act); break; case "ActWindowsControl": HandleWindowsControlAction((ActWindowsControl)act); break; case "ActGenElement": ActGenElement AGE = (ActGenElement)act; HandleWindowsGenericWidgetControlAction(AGE); break; case "ActMenuItem": ActMenuItem actMenuItem = (ActMenuItem)act; HandleMenuControlAction(actMenuItem); break; case "ActSmartSync": mUIAutomationHelper.SmartSyncHandler((ActSmartSync)act); break; case "ActScreenShot": try { //TODO: When capturing all windows, we do showwindow. for few applications show window is causing applicaiton to minimize //Disabling the capturing all windows for Windows driver until we fix show window issue Bitmap bmp = mUIAutomationHelper.GetCurrentWindowBitmap(); act.AddScreenShot(bmp); //if not running well. need to add return same as PBDrive } catch (Exception ex) { act.Error = "Error: Action failed to be performed, Details: " + ex.Message; } break; case "Common.ActUIElement": HandleUIElementAction(act); break; case "ActBrowserElement": ActBrowserElement actWBE = (ActBrowserElement)act; HandleWindowsBrowserElementAction(actWBE); break; case "ActTableElement": ActTableElement actTable = (ActTableElement)act; HandleWindowsWidgetTableControlAction(actTable); break; default: throw new Exception("Action unknown/Not Impl in Driver - " + this.GetType().ToString()); } GC.Collect(); GC.WaitForPendingFinalizers(); } catch (System.Runtime.InteropServices.COMException e) { Reporter.ToLog(eLogLevel.ERROR, "Exception at Run action:" + act.GetType() + " Description:" + act.Description + " Error details:", e); CheckAndRetryRunAction(act, e); return; } catch (ElementNotAvailableException e) { Reporter.ToLog(eLogLevel.ERROR, "Exception at Run action:" + act.GetType() + " Description:" + act.Description + " Error details:", e); CheckAndRetryRunAction(act, e); return; } catch (ArgumentException e) { Reporter.ToLog(eLogLevel.ERROR, "Exception at Run action:" + act.GetType() + " Description:" + act.Description + " Error details:", e); CheckAndRetryRunAction(act, e); return; } catch (Exception e) { Reporter.ToLog(eLogLevel.WARN, "Exception at Run action", e); act.Error = e.Message; } }
public override void RunAction(Act act) { //TODO: add func to Act + Enum for switch string actClass = act.GetType().ToString(); mUIAutomationHelper.mLoadTimeOut = mActionTimeout; mUIAutomationHelper.taskFinished = false; //TODO: avoid hard coded string... actClass = actClass.Replace("GingerCore.Actions.", ""); if (actClass != "ActUIASwitchWindow" && actClass != "ActSwitchWindow") { CheckRetrySwitchWindowIsNeeded(); } if (act.Timeout != null) { mUIAutomationHelper.mLoadTimeOut = act.Timeout; } try { Reporter.ToLog(eLogLevel.DEBUG, "Start Executing action of type '" + actClass + "' Description is" + act.Description); switch (actClass) { case "ActPBControl": ActPBControl actPBC = (ActPBControl)act; HandlePBControlAction(actPBC); break; case "ActGenElement": ActGenElement AGE = (ActGenElement)act; HandlePBGenericWidgetControlAction(AGE); break; case "ActBrowserElement": ActBrowserElement actBE = (ActBrowserElement)act; HandlePBBrowserElementAction(actBE); break; //TODO: ActSwitchWindow is the correct approach for switch window. And we should guide the users accordingly. //Down the line we need to clean up ActUIASwitchWindow. This is old way, but we keep it to support old actions case "ActUIASwitchWindow": mUIAutomationHelper.SwitchWindow((ActUIASwitchWindow)act); break; case "ActSwitchWindow": mUIAutomationHelper.SmartSwitchWindow((ActSwitchWindow)act); break; case "ActMenuItem": ActMenuItem actMenuItem = (ActMenuItem)act; HandleMenuControlAction(actMenuItem); break; case "ActWindow": ActWindow actWindow = (ActWindow)act; HandleWindowControlAction(actWindow); break; //case "ActUIAButton": // ActUIAButton b = (ActUIAButton)act; // UIA.ClickButton(b); // break; //case "ActUIATextBox": // ActUIATextBox ATB = (ActUIATextBox)act; // if (ATB.UIATextBoxAction == ActUIATextBox.eUIATextBoxAction.SetValue) // { // UIA.SetTextBoxValue(ATB); // return; // } // if (ATB.UIATextBoxAction == ActUIATextBox.eUIATextBoxAction.GetValue) UIA.GetTextBoxValue(ATB); // //if (ATB.UIATextBoxAction == ActUIATextBox.eUIATextBoxAction.GetValue) UIA.GetTextBoxValue(ATB); // //if (ATB.UIATextBoxAction == ActUIATextBox.eUIATextBoxAction.IsDisabled) UIA.IsTextBoxDisabled(ATB); // //if (ATB.UIATextBoxAction == ActUIATextBox.eUIATextBoxAction.GetFont) UIA.GetTextBoxFont(ATB); // //if (ATB.UIATextBoxAction == ActUIATextBox.eUIATextBoxAction.IsPrepopulated) UIA.IsTextBoxPrepopulated(ATB); // //if (ATB.UIATextBoxAction == ActUIATextBox.eUIATextBoxAction.IsRequired) UIA.IsTextBoxRequired(ATB); // //if (ATB.UIATextBoxAction == ActUIATextBox.eUIATextBoxAction.IsDisplayed) UIA.IsTextBoxDisplayed(ATB); // //if (ATB.UIATextBoxAction == ActUIATextBox.eUIATextBoxAction.GetInputLength) UIA.GetTextBoxInputLength(ATB); // break; //case "ActUIALabel": // if (((ActUIALabel)act).LabelAction == ActUIALabel.eLabelAction.GetForeColor) UIA.LabelGetColor((ActUIALabel)act); // break; //TODO: What Jave is doing here? is it needed? case "Java.ActTableElement": ActTableElement actTable = (ActTableElement)act; mUIAutomationHelper.HandleGridControlAction(actTable); break; case "ActTableElement": ActTableElement actTable1 = (ActTableElement)act; mUIAutomationHelper.HandleGridControlAction(actTable1); break; case "ActSmartSync": mUIAutomationHelper.SmartSyncHandler((ActSmartSync)act); break; //case "ActUIAClickOnPoint": // ActUIAClickOnPoint ACP = (ActUIAClickOnPoint)act; // if (ACP.ActUIAClickOnPointAction == ActUIAClickOnPoint.eUIAClickOnPointAction.ClickXY) UIA.ClickOnPoint(ACP); // break; case "ActScreenShot": try { //TODO: Implement Multi window capture if (act.WindowsToCapture == Act.eWindowsToCapture.AllAvailableWindows) { List <AppWindow> list = mUIAutomationHelper.GetListOfDriverAppWindows(); List <Bitmap> bList; foreach (AppWindow aw in list) { Bitmap bmp = mUIAutomationHelper.GetAppWindowAsBitmap(aw); act.AddScreenShot(bmp); bList = mUIAutomationHelper.GetAppDialogAsBitmap(aw); foreach (Bitmap tempbmp in bList) { act.AddScreenShot(tempbmp); } bList.Clear(); } } else { Bitmap bmp = mUIAutomationHelper.GetCurrentWindowBitmap(); act.AddScreenShot(bmp); } return; } catch (Exception ex) { act.Error = "Error: Action failed to be performed, Details: " + ex.Message; } break; //case "ActUIAImage": // if (((ActUIAImage)act).ImageAction == ActUIAImage.eImageAction.IsVisible) UIA.ImageIsVisible((ActUIAImage)act); // break; //case "ActPBControl": // ActPBControl APBC = (ActPBControl)act; // RunControlAction(APBC); // break; //case "ActMenuItem": // ActMenuItem ami = (ActMenuItem)act; // MenuItem(ami); // break; case "Common.ActUIElement": //ActUIElement actUIPBC = (ActUIElement)act; HandleUIElementAction(act); break; default: throw new Exception("Action unknown/Not Impl in Driver - " + this.GetType().ToString()); } } catch (System.Runtime.InteropServices.COMException e) { Reporter.ToLog(eLogLevel.ERROR, "Exception at Run action:" + act.GetType() + " Description:" + act.Description + " Error details:", e); CheckAndRetryRunAction(act, e); return; } catch (ElementNotAvailableException e) { Reporter.ToLog(eLogLevel.ERROR, "Exception at Run action:" + act.GetType() + " Description:" + act.Description + " Error details:", e); CheckAndRetryRunAction(act, e); return; } catch (ArgumentException e) { Reporter.ToLog(eLogLevel.ERROR, "Exception at Run action:" + act.GetType() + " Description:" + act.Description + " Error details:", e); CheckAndRetryRunAction(act, e); return; } catch (Exception e) { Reporter.ToLog(eLogLevel.WARN, "Exception at Run action", e); act.Error = e.Message; } }
public abstract void HandleGridControlAction(ActTableElement act);
public override void HandleGridControlAction(ActTableElement act) { throw new NotImplementedException(); }