Example #1
0
 private static ActUIElement CreateUIElementAction(ElementInfo elementInfo, ActUIElement.eElementAction action)
 {
     return(new ActUIElement()
     {
         Description = action + " : " + elementInfo.ElementTitle,
         ElementAction = action,
         ElementType = elementInfo.ElementTypeEnum
     });
 }
        private void UpdateActionInfo(ActUIElement.eElementAction SelectedAction)
        {
            // TODO - Add case for KeyboardChange event for LocateValue
            // TODO - Add KeyboardChangeEventHandler for LocateValueEditPage

            xActionInfoLabel.Text = string.Empty;
            TextBlockHelper text = new TextBlockHelper(xActionInfoLabel);

            xActionInfoLabel.Visibility = Visibility.Visible;
            if (mAction.ElementType.ToString() != null && mAction.ElementType.ToString() != "" && mAction.ElementType != eElementType.Unknown)
            {
                text.AddBoldText(string.Format("Configured '{0}'", GetEnumValueDescription(typeof(eElementType), mAction.ElementType)));
                if (mAction.ElementLocateBy.ToString() != null && mAction.ElementLocateBy.ToString() != "" && mAction.ElementLocateBy.ToString() != ActUIElement.eElementAction.Unknown.ToString())
                {
                    text.AddBoldText(string.Format(" to be located by '{0}'", GetEnumValueDescription(typeof(eLocateBy), mAction.ElementLocateBy)));
                }

                if (SelectedAction.ToString() != null && SelectedAction.ToString() != ActUIElement.eElementAction.Unknown.ToString())
                {
                    text.AddBoldText(string.Format(" to perform '{0}' operation.", GetEnumValueDescription(typeof(ActUIElement.eElementAction), SelectedAction)));
                }
            }
            else
            {
                if (mAction.ElementLocateBy.ToString() != null && mAction.ElementLocateBy.ToString() != "" && mAction.ElementLocateBy.ToString() != ActUIElement.eElementAction.Unknown.ToString())
                {
                    text.AddBoldText(string.Format(" '{0}'", GetEnumValueDescription(typeof(eLocateBy), mAction.ElementLocateBy)));
                }
                if (mAction.TargetLocateBy.ToString() != null && mAction.TargetLocateBy.ToString() != "" && mAction.TargetLocateBy.ToString() != ActUIElement.eElementAction.Unknown.ToString())
                {
                    text.AddBoldText(string.Format(" '{0}'", GetEnumValueDescription(typeof(eLocateBy), mAction.TargetLocateBy)));
                }
                if (mAction.TargetElementType.ToString() != null && mAction.TargetElementType.ToString() != "" && mAction.TargetElementType.ToString() != ActUIElement.eElementAction.Unknown.ToString())
                {
                    if (!string.IsNullOrEmpty(text.GetText()))
                    {
                        text.AddBoldText(string.Format(" '{0}'", GetEnumValueDescription(typeof(eElementType), mAction.TargetElementType)));
                    }
                    else
                    {
                        text.AddBoldText(string.Format(" '{0}'", GetEnumValueDescription(typeof(eElementType), mAction.ElementType)));
                    }
                }
                if (mAction.ElementType.ToString() != null && mAction.ElementType.ToString() != "" && mAction.ElementType.ToString() != ActUIElement.eElementAction.Unknown.ToString())
                {
                    text.AddBoldText(string.Format(" '{0}'", GetEnumValueDescription(typeof(eElementType), mAction.ElementType)));
                }
                if (SelectedAction.ToString() != null && SelectedAction.ToString() != "" && SelectedAction != ActUIElement.eElementAction.Unknown)
                {
                    text.AddBoldText(string.Format(" '{0}' operation", GetEnumValueDescription(typeof(ActUIElement.eElementAction), SelectedAction)));
                }
            }
        }
Example #3
0
        public override List <ActUIElement.eTableAction> GetTableControlActions(ActUIElement.eElementAction tableAction)
        {
            List <ActUIElement.eTableAction> list = new List <ActUIElement.eTableAction>();

            switch (tableAction)
            {
            case ActUIElement.eElementAction.TableCellAction:
                list.Add(ActUIElement.eTableAction.IsCellEnabled);
                list.Add(ActUIElement.eTableAction.IsVisible);
                list.Add(ActUIElement.eTableAction.GetValue);
                list.Add(ActUIElement.eTableAction.SetValue);
                list.Add(ActUIElement.eTableAction.SetFocus);
                list.Add(ActUIElement.eTableAction.Click);
                list.Add(ActUIElement.eTableAction.AsyncClick);
                list.Add(ActUIElement.eTableAction.WinClick);
                list.Add(ActUIElement.eTableAction.Toggle);
                list.Add(ActUIElement.eTableAction.DoubleClick);
                list.Add(ActUIElement.eTableAction.Type);
                list.Add(ActUIElement.eTableAction.MousePressAndRelease);
                list.Add(ActUIElement.eTableAction.IsChecked);
                list.Add(ActUIElement.eTableAction.RightClick);
                break;

            case ActUIElement.eElementAction.TableRowAction:
                list.Add(ActUIElement.eTableAction.GetSelectedRow);
                list.Add(ActUIElement.eTableAction.ActivateRow);
                break;

            case ActUIElement.eElementAction.TableAction:
                list.Add(ActUIElement.eTableAction.GetRowCount);
                list.Add(ActUIElement.eTableAction.SelectAllRows);
                //list.Add(ActUIElement.eTableAction.RightClick);
                break;

            case ActUIElement.eElementAction.Unknown:
                list.Add(ActUIElement.eTableAction.IsCellEnabled);
                list.Add(ActUIElement.eTableAction.IsVisible);
                list.Add(ActUIElement.eTableAction.GetValue);
                list.Add(ActUIElement.eTableAction.SetValue);
                list.Add(ActUIElement.eTableAction.SetFocus);
                list.Add(ActUIElement.eTableAction.Click);
                list.Add(ActUIElement.eTableAction.AsyncClick);
                list.Add(ActUIElement.eTableAction.WinClick);
                list.Add(ActUIElement.eTableAction.Toggle);
                list.Add(ActUIElement.eTableAction.GetRowCount);
                list.Add(ActUIElement.eTableAction.GetSelectedRow);
                break;
            }
            return(list);
        }
Example #4
0

        
Example #5
0
 public virtual List <ActUIElement.eTableAction> GetTableControlActions(ActUIElement.eElementAction tableAction)
 {
     return(null);
 }
Example #6
0
        public override List <ActUIElement.eTableAction> GetTableControlActions(ActUIElement.eElementAction tableAction)
        {
            List <ActUIElement.eTableAction> pbTableControlActionlist = base.GetTableControlActions(tableAction);

            return(pbTableControlActionlist);
        }
        public ActionResult ClickElementByOthertypes(ActUIElement.eElementAction executedClick, List <ActUIElement.eElementAction> clicks, AutomationElement automationElement, AutomationElement elementToValidate, string validationElementType, ActUIElement.eElementAction validationType)
        {
            ActUIElement.eElementAction currentClick;
            //string result = "";
            ActionResult actionResult = new ActionResult();

            bool isClicked   = false;
            bool isValidated = false;

            for (int i = 0; i < clicks.Count; i++)
            {
                currentClick = clicks[i];
                if (currentClick != executedClick)
                {
                    isClicked = PerformClick(automationElement, currentClick);
                    if (isClicked)
                    {
                        isValidated = LocateAndValidateElement(elementToValidate, validationElementType, validationType);
                        if (isValidated)
                        {
                            break;
                        }
                    }
                }
            }
            if (isValidated)
            {
                actionResult.executionInfo = "Successfully clicked and validated";
            }
            return(actionResult);
        }
        public bool LocateAndValidateElement(AutomationElement elementToValidate, string elementType, ActUIElement.eElementAction actionType, string validationValue = "")
        {
            ActionResult actionResult = new ActionResult();
            bool         result       = false;

            switch (actionType)
            {
            case ActUIElement.eElementAction.IsEnabled:
                result = elementToValidate.Current.IsEnabled;
                break;

            case ActUIElement.eElementAction.Exist:
                if (elementToValidate != null)
                {
                    result = true;
                }
                break;

            case ActUIElement.eElementAction.NotExist:
                if (elementToValidate == null)
                {
                    result = true;
                }
                break;

            case ActUIElement.eElementAction.GetValue:
                if (elementToValidate == null)
                {
                    result = false;
                }
                actionResult = GetValue(elementToValidate, eElementType.Unknown);
                if (!string.IsNullOrEmpty(actionResult.errorMessage) || string.IsNullOrEmpty(actionResult.outputValue))
                {
                    actionResult = GetText(elementToValidate);
                }
                if (actionResult.outputValue == validationValue)
                {
                    result = true;
                }
                break;
            }

            return(result);
        }