示例#1
0
        public ActWindowsControlEditPage(ActWindowsControl Act)
        {
            InitializeComponent();

            mAct = Act;

            App.FillComboFromEnumVal(ActionNameComboBox, mAct.ControlAction);
            App.ObjFieldBinding(ActionNameComboBox, ComboBox.TextProperty, Act, ActWindowsControl.Fields.ControlAction);
        }
        public ActWindowsControlEditPage(ActWindowsControl Act)
        {
            InitializeComponent();

            mAct = Act;

            GingerCore.General.FillComboFromEnumObj(ActionNameComboBox, mAct.ControlAction);
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(ActionNameComboBox, ComboBox.TextProperty, Act, ActWindowsControl.Fields.ControlAction);
        }
示例#3
0
        private void HandleWindowsControlAction(ActWindowsControl actWC)
        {
            object AE = null;

            if (actWC.ControlAction != ActWindowsControl.eControlAction.IsExist)
            {
                AE = mUIAutomationHelper.GetActElement(actWC);
                if (AE == null)
                {
                    actWC.Error = "Element not Found - " + actWC.LocateBy + " " + actWC.LocateValueCalculated;
                    return;
                }
            }
            try
            {
                switch (actWC.ControlAction)
                {
                case ActWindowsControl.eControlAction.SetValue:
                    mUIAutomationHelper.SetControlValue(AE, actWC.ValueForDriver);
                    actWC.ExInfo = actWC.ValueForDriver + " set";
                    break;

                case ActWindowsControl.eControlAction.SendKeys:
                    mUIAutomationHelper.SendKeysToControl(AE, actWC.ValueForDriver);
                    actWC.ExInfo = actWC.ValueForDriver + " set";
                    break;

                case ActWindowsControl.eControlAction.GetValue:
                    string val = mUIAutomationHelper.GetControlValue(AE);
                    actWC.AddOrUpdateReturnParamActual("Actual", val);
                    actWC.ExInfo = val;
                    break;

                case ActWindowsControl.eControlAction.Select:
                    mUIAutomationHelper.SetControlValue(AE, actWC.ValueForDriver);
                    break;

                case ActWindowsControl.eControlAction.Click:
                    string status = mUIAutomationHelper.ClickElement(AE);
                    if (!status.Contains("Clicked Successfully"))
                    {
                        actWC.Error += status;
                    }
                    else
                    {
                        actWC.ExInfo += status;
                    }
                    break;

                case ActWindowsControl.eControlAction.AsyncClick:
                    status = mUIAutomationHelper.ClickElement(AE, true);
                    if (!status.Contains("Clicked Successfully"))
                    {
                        actWC.Error += status;
                    }
                    else
                    {
                        actWC.ExInfo += status;
                    }
                    break;

                case ActWindowsControl.eControlAction.ClickXY:
                    mUIAutomationHelper.ClickOnXYPoint(AE, actWC.ValueForDriver);
                    break;

                case ActWindowsControl.eControlAction.RightClick:
                    mUIAutomationHelper.DoRightClick(AE, actWC.ValueForDriver);
                    break;

                case ActWindowsControl.eControlAction.DoubleClick:
                    mUIAutomationHelper.DoDoubleClick(AE, actWC.ValueForDriver);
                    break;

                case ActWindowsControl.eControlAction.Maximize:
                case ActWindowsControl.eControlAction.Minimize:
                case ActWindowsControl.eControlAction.Restore:
                    status = mUIAutomationHelper.SetElementVisualState(AE, actWC.ControlAction.ToString());
                    if (!status.Contains("State set successfully"))
                    {
                        actWC.Error = status;
                    }
                    else
                    {
                        actWC.ExInfo += status;
                    }
                    break;

                case ActWindowsControl.eControlAction.Resize:
                    status = mUIAutomationHelper.SetElementSize(AE, actWC.ValueForDriver);
                    if (!status.Contains("Element resize Successfully"))
                    {
                        actWC.Error = status;
                    }
                    else
                    {
                        actWC.ExInfo += status;
                    }
                    break;

                case ActWindowsControl.eControlAction.GetText:
                    string valText = mUIAutomationHelper.GetControlText(AE, actWC.ValueForDriver);
                    actWC.AddOrUpdateReturnParamActual("Actual", valText);
                    actWC.ExInfo = valText;
                    break;

                case ActWindowsControl.eControlAction.GetSelected:
                    string selectedItem = mUIAutomationHelper.GetSelectedItem(AE);
                    actWC.AddOrUpdateReturnParamActual("Selected Item", selectedItem);
                    actWC.ExInfo = selectedItem;
                    break;

                case ActWindowsControl.eControlAction.GetTitle:
                    string title = mUIAutomationHelper.GetDialogTitle(AE);
                    actWC.AddOrUpdateReturnParamActual("Dialog Title", title);
                    actWC.ExInfo = title;
                    break;

                case ActWindowsControl.eControlAction.Toggle:
                    string value = mUIAutomationHelper.ToggleControlValue(AE);
                    actWC.AddOrUpdateReturnParamActual("Actual", value);
                    actWC.ExInfo = value;
                    break;

                case ActWindowsControl.eControlAction.IsEnabled:
                    string valueIsEnabled = mUIAutomationHelper.IsEnabledControl(AE);
                    actWC.AddOrUpdateReturnParamActual("Actual", valueIsEnabled);
                    actWC.ExInfo = valueIsEnabled;
                    break;

                case ActWindowsControl.eControlAction.IsExist:
                    string valueIsExist = mUIAutomationHelper.IsElementExist(actWC.LocateBy, actWC.LocateValue).ToString();
                    actWC.Error = "";
                    actWC.AddOrUpdateReturnParamActual("Actual", valueIsExist);
                    actWC.ExInfo = valueIsExist;
                    break;

                case ActWindowsControl.eControlAction.Scrolldown:
                    mUIAutomationHelper.ScrollDown(AE);
                    break;

                case ActWindowsControl.eControlAction.ScrollUp:
                    mUIAutomationHelper.ScrollUp(AE);
                    break;

                case ActWindowsControl.eControlAction.IsSelected:
                    string isSelected = mUIAutomationHelper.IsControlSelected(AE);
                    actWC.AddOrUpdateReturnParamActual("Actual", isSelected);
                    actWC.ExInfo = isSelected;
                    break;

                case ActWindowsControl.eControlAction.Highlight:
                    mUIAutomationHelper.HiglightElement(mUIAutomationHelper.GetElementInfoFor(AE));
                    break;

                case ActWindowsControl.eControlAction.GetControlProperty:
                    string propValue = mUIAutomationHelper.GetControlPropertyValue(AE, actWC.ValueForDriver);
                    actWC.AddOrUpdateReturnParamActual("Actual", propValue);
                    actWC.ExInfo = propValue;
                    break;

                case ActWindowsControl.eControlAction.Repaint:
                    mUIAutomationHelper.HandlePaintWindow(AE);
                    break;

                case ActWindowsControl.eControlAction.SelectContextMenuItem:
                    bool result = false;
                    result = mUIAutomationHelper.ClickContextMenuItem(AE, actWC.Value);

                    if (result)
                    {
                        actWC.ExInfo += "Element Clicked";
                    }
                    else
                    {
                        actWC.Error = "Unable to Click Element";
                    }
                    break;

                default:
                    actWC.Error = "Unknown Action  - " + actWC.ControlAction;
                    break;
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }