Ejemplo n.º 1
0
        /// <summary>
        /// get an UIA action for the line
        /// </summary>
        /// <param name="actLine">the action line</param>
        /// <returns>the UIA action</returns>
        public override abt.Action getAction(abt.ActionLine actLine)
        {
            Window  targetWindow  = null;
            IUIItem targetControl = null;

            if (!Actions.ContainsKey(actLine.ActionName))
            {
                throw new Exception(abt.Constants.Messages.Error_Executing_NoAction);
            }
            if (actLine.WindowName != null && !Parent.Interfaces.ContainsKey(actLine.WindowName))
            {
                throw new Exception(abt.Constants.Messages.Error_Matching_Window_NoDefinition);
            }

            // search for the target control
            if (actLine.WindowName != null)
            {
                targetWindow = FindWindow(Parent.Interfaces[actLine.WindowName].Properties);
            }
            if (actLine.ControlName != null)
            {
                targetControl = FindControl(targetWindow, Parent.Interfaces[actLine.WindowName].Controls[actLine.ControlName]);
            }

            // prepare the action
            UIAAction action = Actions[actLine.ActionName] as UIAAction;

            action.Window  = targetWindow;
            action.Control = targetControl;
            action.Params  = actLine.Arguments;

            return(action);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// get a Selenium Action for the line
        /// </summary>
        /// <param name="actLine">the action line</param>
        /// <returns>the Selenium Action</returns>
        public override abt.Action getAction(abt.ActionLine actLine)
        {
            IWebElement targetControl = null;

            if (!Actions.ContainsKey(actLine.ActionName))
            {
                throw new Exception(abt.Constants.Messages.Error_Executing_NoAction);
            }
            if (actLine.WindowName != null && !CheckWindow(actLine.WindowName))
            {
                throw new Exception(abt.Constants.Messages.Error_Matching_Control_NoDefinition);
            }
            if (actLine.ControlName != null && !Parent.Interfaces[actLine.WindowName].Controls.ContainsKey(actLine.ControlName))
            {
                throw new Exception(abt.Constants.Messages.Error_Matching_Control_NoDefinition);
            }

            if (actLine.WindowName != null && actLine.ControlName != null)
            {
                targetControl = FindControl(Parent.Interfaces[actLine.WindowName].Controls[actLine.ControlName]);
            }

            // prepare the action
            SeleniumAction action = Actions[actLine.ActionName] as SeleniumAction;

            action.Control = targetControl;
            action.Params  = actLine.Arguments;

            return(action);
        }