Пример #1
0
        private void RunConditionAction(PageAction pageAction)
        {
            if (pageAction.ConditoinAction == null || pageAction.ConditoinAction.Count == 0)
            {
                return;
            }

            foreach (IAction action in pageAction.ConditoinAction)
            {
                this.RunAction(action);
            }


            int pageIndex = StringConvertTo.ConvertTo <int>(this.GetData <string>("conditionActions_page_Index"));
            int pageCount = StringConvertTo.ConvertTo <int>(this.GetData <string>("conditionActions_page_Count"));

            if (pageIndex < 1)
            {
                throw new ElementNoFoundException("PageTask No Result", pageAction);
            }
            if (pageCount < 1)
            {
                throw new ElementNoFoundException("PageTask No Result", pageAction);
            }

            int max = pageAction.MaxPageIndex > pageCount ? pageCount : pageAction.MaxPageIndex;

            if (pageIndex < max)
            {
                return;
            }

            throw new ElementNoFoundException("PageTask Element Not Found", pageAction);
        }
Пример #2
0
        public ActionBase(AutomationAction automationActionData)
        {
            this.automationActionData = automationActionData;

            if (this.automationActionData.Context != null)
            {
                string strFrame = this.automationActionData.Context.Frame;

                if (!string.IsNullOrEmpty(strFrame))
                {
                    this.ActionContext = new ActionContext();
                    int frameIndex;
                    if (int.TryParse(strFrame, out frameIndex))
                    {
                        this.ActionContext.FrameIndex = frameIndex;
                    }
                    else
                    {
                        this.ActionContext.FrameIndex = -1;
                        this.ActionContext.FrameName  = strFrame;
                    }
                }
            }

            this.SaveData    = StringConvertTo.ConvertTo <bool>(automationActionData.SaveData, true);
            this.GetDatakey  = GetAttributeValue <string>("getDatakey");
            this.SaveDatakey = GetAttributeValue <string>("saveDatakey");
            this.Wait        = GetAttributeValue <int>("wait", 0);
        }
Пример #3
0
        protected T GetAttributeValue <T>(string name, T defaultValue)
        {
            name = name.ToLower();
            if (this.automationActionData.AttributeList != null && this.automationActionData.AttributeList.Count > 0)
            {
                foreach (AutomationActionAttribute attr in this.automationActionData.AttributeList)
                {
                    if (attr.Name.ToLower() == name)
                    {
                        return(StringConvertTo.ConvertTo <T>(attr.Value, defaultValue));
                    }
                }
            }

            return(defaultValue);
        }
Пример #4
0
        protected List <T> GetAttributeValueStartWith <T>(string name, T defaultValue)
        {
            List <T> list = null;

            name = name.ToLower();
            if (this.automationActionData.AttributeList != null && this.automationActionData.AttributeList.Count > 0)
            {
                foreach (AutomationActionAttribute attr in this.automationActionData.AttributeList)
                {
                    if (attr.Name.ToLower().StartsWith(name))
                    {
                        if (list == null)
                        {
                            list = new List <T>();
                        }

                        list.Add(StringConvertTo.ConvertTo <T>(attr.Value, defaultValue));
                    }
                }
            }

            return(list);
        }