コード例 #1
0
 //**********************************************************************
 /// <summary>
 /// Form action: VerifyProperty equal, Contains, NotContains.
 /// </summary>
 public static void VerifyProperty(LxScriptItem item)
 {
     if (item.getArg2Text() == "Equal")
     {
         Validate.Attribute(item.getComponentInfo(), item.getArgText(), item.getArg3Text());
     }
     if (item.getArg2Text() == "Contains")
     {
         Validate.Attribute(item.getComponentInfo(), item.getArgText(), new Regex(Regex.Escape(item.getArg3Text())));
     }
     if (item.getArg2Text() == "NotContains")
     {
         Validate.Attribute(item.getComponentInfo(), item.getArgText(), new Regex("^((?!(" + Regex.Escape(item.getArg3Text()) + ")).)*$"));
     }
 }
コード例 #2
0
        //**********************************************************************
        /// <summary>
        /// Click to given items in the comoponet like List, Table and Tree.
        /// </summary>
        public static void Select_Item(LxScriptItem item)
        {
            object       objComponet     = item.getComponent();
            RepoItemInfo objComponetInfo = item.getComponentInfo();
            Type         objType         = objComponet.GetType();

            //MessageBox.Show(objType.Name.ToString());

            if (objType.Name.ToString() == "List")
            {
                RepoItemInfo targetListItemInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableListItem",
                                                                   objComponetInfo.Path + "/listitem[@accessiblename='" + item.getArgText() + "']",
                                                                   10000, null, System.Guid.NewGuid().ToString());
                Ranorex.ListItem targetListItem = targetListItemInfo.CreateAdapter <Ranorex.ListItem>(true);
                targetListItem.Click();
            }

            if (objType.Name.ToString() == "Table")
            {
                RepoItemInfo targetCellInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableCell",
                                                               objComponetInfo.Path + "/row/cell[@text='" + item.getArgText() + "']",
                                                               10000, null, System.Guid.NewGuid().ToString());
                Ranorex.Cell targetCell = targetCellInfo.CreateAdapter <Ranorex.Cell>(true);
                targetCell.Click();
            }

            if (objType.Name.ToString() == "Tree")
            {
                int    treeLevel       = Convert.ToInt32(item.getArgText());
                string strTreelevel    = "";
                string strTreelevelCkb = "";
                for (int i = 1; i <= treeLevel; i++)
                {
                    strTreelevel    += "/treeitem";
                    strTreelevelCkb += "/checkbox";
                }

                RepoItemInfo targetTreeItemInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableTreeItem",
                                                                   objComponetInfo.Path + strTreelevel + "[@accessiblename='" + item.getArg2Text() + "']",
                                                                   10000, null, System.Guid.NewGuid().ToString());

                if (targetTreeItemInfo.Exists())
                {
                    Ranorex.TreeItem targetTreeItem = targetTreeItemInfo.CreateAdapter <Ranorex.TreeItem>(true);
                    targetTreeItem.Click();
                }
                else
                {
                    targetTreeItemInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableTreeItem1",
                                                          objComponetInfo.Path + strTreelevelCkb + "[@accessiblename='" + item.getArg2Text() + "']",
                                                          10000, null, System.Guid.NewGuid().ToString());
                    Ranorex.CheckBox targetTreeItemCkb = targetTreeItemInfo.CreateAdapter <Ranorex.CheckBox>(true);
                    targetTreeItemCkb.Click();
                }
            }
        }
コード例 #3
0
        //**********************************************************************
        /// <summary>
        /// Input Cell by given index in the Table.
        /// </summary>
        public static void Input_Cell(LxScriptItem item)
        {
            object       objComponet     = item.getComponent();
            RepoItemInfo objComponetInfo = item.getComponentInfo();
            Type         objType         = objComponet.GetType();

            if (objType.Name.ToString() == "Table")
            {
                Ranorex.Table tb = (Ranorex.Table)objComponet;
                tb.Rows[Convert.ToInt32(item.getArgText())].Cells[Convert.ToInt32(item.getArg2Text())].DoubleClick();
                Keyboard.Press("{CONTROL down}{Akey}{CONTROL up}" + item.getArg3Text());
            }
        }
コード例 #4
0
        //**********************************************************************
        /// <summary>
        /// Execute one command, parse the command.
        /// </summary>
        public static bool executeCommand(LxScriptItem item)
        {
            if (item.m_Type == "F")
            {
                return(executeFormCommand(item));
            }

            if (item.m_Type == "C" && item.m_WindowName == "Pause")
            {
                Delay.Milliseconds(Convert.ToInt32(item.m_Component) * 1000);
                return(true);
            }

            if (item.m_Type == "C" && item.m_WindowName == "VerifyTxtfileValues")
            {
                VerifyTxtfileValues(item);
                return(true);
            }

            if (item.m_Type == "C" && item.m_WindowName == "VerifyExcelfileValues")
            {
                VerifyExcelfileValues(item);
                return(true);
            }

            if (item.m_Type == "C" && item.m_WindowName == "SendCommandToSimulator")
            {
                SendCommandToSimulator(item);
                return(true);
            }

            if (item.m_Type == "C" && item.m_WindowName == "CopyDataToFile")
            {
                CopyDataToFile(item);
                return(true);
            }

            if (item.m_Type == "C" && item.m_WindowName == "LaunchApplication")
            {
                AppStart(item);
                return(true);
            }

            if (item.m_Type == "C" && item.m_WindowName == "DeleteLocalFile")
            {
                DeleteLocalFile(item);
                return(true);
            }

            if (item.m_Type == "C" && item.m_WindowName == "CloseApplication")
            {
                AppClose(item);
                return(true);
            }

            if (item.m_Type.Substring(0, 1) == ";")
            {
                return(true);
            }

            if (item.m_Action == "Exists")
            {
                Validate.Exists(item.getComponentInfo());
                return(true);
            }

            if (item.m_Action == "NotExists")
            {
                Validate.NotExists(item.getComponentInfo());
                return(true);
            }

            if (item.m_Action == "VerifyProperty")
            {
                //PropertyInfo property = objType.GetProperty(item.m_Arg1);
                //property.GetValue(objComponet, null).ToString();
                //Validate.Attribute(item.getComponentInfo(),item.m_Arg1,item.m_Arg2);
                //Validate.Attribute(
                VerifyProperty(item);
                return(true);
            }

            object[]   arg    = (object[])m_ActionMap[item.m_Action];
            MethodInfo method = null;

            object[] parameters = null;

            if (arg[1].ToString() == "S2")
            {
                repo.myCustom = item.getArgText();
            }
            if (item.m_Index == "33")
            {
                Delay.Milliseconds(2000);
            }
            object       objComponet     = item.getComponent();
            RepoItemInfo objComponetInfo = item.getComponentInfo();
            Type         objType         = objComponet.GetType();

            if (arg[1].ToString() == "0" || arg[1].ToString() == "S2")
            {
                method = objType.GetMethod(arg[0].ToString(),
                                           new Type[] {});
                parameters = new object[] {};
            }
            if (arg[1].ToString() == "1")
            {
                method = objType.GetMethod(arg[0].ToString(),
                                           new Type[] { typeof(string) });
                parameters = new object[] { item.getArgText() };
            }
            if (arg[1].ToString() == "S1")
            {
                PropertyInfo pi = objType.GetProperty(arg[0].ToString());
                pi.SetValue(objComponet, item.getArgText(), null);
                return(true);
            }

            if (arg[1].ToString() == "S3")
            {
                method = objType.GetMethod(arg[0].ToString(),
                                           new Type[] { typeof(string) });
                parameters = new object[] { item.getArgText() };
                PropertyInfo pi = objType.GetProperty("TextValue") != null?objType.GetProperty("TextValue") : objType.GetProperty("Text");

                pi.SetValue(objComponet, "", null);
            }

            if (arg[1].ToString() == "S4")
            {
                Select_Item(item);
                return(true);
            }

            if (arg[1].ToString() == "S5")
            {
                method = objType.GetMethod(arg[0].ToString(),
                                           new Type[] { });
                parameters = new object[] {};
                method.Invoke(objComponet, parameters);
                Delay.Milliseconds(1500);
                Validate.AreEqual(Ranorex.ToolTip.Current.Text, item.getArgText());
                return(true);
            }

            if (arg[1].ToString() == "S6")
            {
                VerifyContains(item);
                return(true);
            }

            if (arg[1].ToString() == "S7")
            {
                VerifyNotContains(item);
                return(true);
            }

            if (arg[1].ToString() == "S8")
            {
                MoveTo(item);
                return(true);
            }

            if (arg[1].ToString() == "S9")
            {
                Click_Cell(item);
                return(true);
            }

            if (arg[1].ToString() == "S10")
            {
                DoubleClick_Item(item);
                return(true);
            }

            if (arg[1].ToString() == "S11")
            {
                RightClick_Item(item);
                return(true);
            }

            if (arg[1].ToString() == "S12")
            {
                Input_Cell(item);
                return(true);
            }

            if (arg[1].ToString() == "S13")             //click location
            {
                Adapter adapterObj = (Adapter)objComponet;
                int     x_loc      = Convert.ToInt16(item.m_Arg2);
                int     y_loc      = Convert.ToInt16(item.m_Arg3);
                adapterObj.Click((item.m_Arg1.Equals("right") ? MouseButtons.Right : MouseButtons.Left), new Location(x_loc, y_loc));
            }


            method.Invoke(objComponet, parameters);
            return(true);
        }
コード例 #5
0
        //**********************************************************************
        /// <summary>
        /// Form action: VerifyProperty equal, Contains, NotContains.
        /// </summary>
        public static void VerifyProperty(LxScriptItem item)
        {
            //MessageBox.Show(item.getComponent().ToString());
            // The component is lable
            string testtemp = item.getComponent().ToString();

            if (item.getComponent().ToString().IndexOf("Lbl") != -1)
            {
                Ranorex.NativeWindow nativeWnd = item.getComponentInfo().CreateAdapter <Ranorex.NativeWindow>(false);
                string lableText = nativeWnd.WindowText;

                if (item.getArg2Text() == "Equal")
                {
                    string abc = item.getArg3Text();
                    Validate.AreEqual(lableText, item.getArg3Text());
                }
                if (item.getArg2Text() == "Contains")
                {
                    int iFlag = lableText.IndexOf(item.getArg3Text());
                    Validate.IsTrue(iFlag != -1);
                }
                if (item.getArg2Text() == "NotContains")
                {
                    int iFlag = lableText.IndexOf(item.getArg3Text());
                    Validate.IsTrue(iFlag == -1);
                }
                return;
            }

            if (item.getArg2Text() == "Equal")
            {
                Validate.Attribute(item.getComponentInfo(), item.getArgText(), item.getArg3Text());
            }
            if (item.getArg2Text() == "Contains")
            {
                Validate.Attribute(item.getComponentInfo(), item.getArgText(), new Regex(Regex.Escape(item.getArg3Text())));
            }
            if (item.getArg2Text() == "NotContains")
            {
                Validate.Attribute(item.getComponentInfo(), item.getArgText(), new Regex("^((?!(" + Regex.Escape(item.getArg3Text()) + ")).)*$"));
            }

            if (item.getArg2Text() == "ListContains")
            {
                bool             Resultflag  = false;
                object           objComponet = item.getComponent();
                Ranorex.ComboBox myComboBox  = (Ranorex.ComboBox)(objComponet);
                Ranorex.Button   btn         = myComboBox.FindSingle("./button");
                btn.Click();
                List lst = "/list";
                foreach (ListItem lst_item in lst.FindChildren <ListItem>())
                {
                    if ((lst_item.Text).Equals(item.getArg3Text()))
                    {
                        Resultflag = true;
                        break;
                    }
                }
                btn.Click();
                Validate.AreEqual(Resultflag, true);
            }
        }
コード例 #6
0
ファイル: LxGenericAction.cs プロジェクト: YouwenYao/Alex
        //**********************************************************************
        /// <summary>
        /// Form action: VerifyProperty equal, Contains, NotContains.
        /// </summary>
        public static void VerifyProperty(LxScriptItem item)
        {
            //MessageBox.Show(item.getComponent().ToString());
            // The component is lable
            string testtemp = item.getComponent().ToString();
            if(item.getComponent().ToString().IndexOf("Lbl") != -1)
            {
                Ranorex.NativeWindow nativeWnd = item.getComponentInfo().CreateAdapter<Ranorex.NativeWindow>(false);
                string lableText = nativeWnd.WindowText;

                if(item.getArg2Text() == "Equal")
                {string abc = item.getArg3Text();
                    Validate.AreEqual(lableText, item.getArg3Text());
                }
                if(item.getArg2Text() == "Contains")
                {
                    int iFlag = lableText.IndexOf(item.getArg3Text());
                    Validate.IsTrue(iFlag != -1);
                }
                if(item.getArg2Text() == "NotContains")
                {
                    int iFlag = lableText.IndexOf(item.getArg3Text());
                    Validate.IsTrue(iFlag == -1);
                }
                return;
            }

            if(item.getArg2Text() == "Equal")
            {
                Validate.Attribute(item.getComponentInfo(), item.getArgText(), item.getArg3Text());
            }
            if(item.getArg2Text() == "Contains")
            {
                Validate.Attribute(item.getComponentInfo(), item.getArgText(), new Regex(Regex.Escape(item.getArg3Text())));
            }
            if(item.getArg2Text() == "NotContains")
            {
                Validate.Attribute(item.getComponentInfo(), item.getArgText(), new Regex("^((?!("+Regex.Escape(item.getArg3Text())+")).)*$"));
            }

            if(item.getArg2Text() == "ListContains")
            {
                bool Resultflag = false;
                object objComponet = item.getComponent();
                Ranorex.ComboBox myComboBox = (Ranorex.ComboBox)(objComponet);
                Ranorex.Button btn = myComboBox.FindSingle("./button");
                btn.Click();
                List lst = "/list";
                foreach (ListItem lst_item in lst.FindChildren<ListItem>())
                {
                    if((lst_item.Text).Equals(item.getArg3Text()))
                    {
                        Resultflag = true;
                        break;
                    }
                }
                btn.Click();
                Validate.AreEqual(Resultflag,true);

            }
        }
コード例 #7
0
ファイル: LxGenericAction.cs プロジェクト: YouwenYao/Alex
        //**********************************************************************
        /// <summary>
        /// Verify the comoponet like List, Table and Tree not contains given items.
        /// </summary>
        public static void VerifyNotContains(LxScriptItem item)
        {
            object objComponet = item.getComponent();
            RepoItemInfo objComponetInfo = item.getComponentInfo();
            Type objType = objComponet.GetType();

            if(objType.Name.ToString() == "List")
            {
                RepoItemInfo targetListItemInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableListItem",
                                                                   objComponetInfo.Path + "/listitem[@accessiblename='"+ item.getArgText() +"']",
                                                                   10000, null, System.Guid.NewGuid().ToString());
                Validate.AreEqual(targetListItemInfo.Exists(),false);
            }

            if(objType.Name.ToString() == "Table")
            {
                RepoItemInfo targetCellInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableCell",
                                                                   objComponetInfo.Path + "/row/cell[@text='"+ item.getArgText() +"']",
                                                                   10000, null, System.Guid.NewGuid().ToString());
                Validate.AreEqual(targetCellInfo.Exists(),false);
            }

            if(objType.Name.ToString() == "Tree")
            {
                int treeLevel = Convert.ToInt32(item.getArgText());
                string strTreelevel = "";
                for(int i = 1 ; i <= treeLevel; i++)
                {
                    strTreelevel += "/treeitem";
                }
                RepoItemInfo targetTreeItemInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableTreeItem",
                                                                   objComponetInfo.Path + strTreelevel +"[@accessiblename='"+ item.getArg2Text() +"']",
                                                                   10000, null, System.Guid.NewGuid().ToString());
                Validate.AreEqual(targetTreeItemInfo.Exists(),false);
            }
        }
コード例 #8
0
ファイル: LxGenericAction.cs プロジェクト: YouwenYao/Alex
        //**********************************************************************
        /// <summary>
        /// Click to given items in the comoponet like List, Table and Tree.
        /// </summary>
        public static void Select_Item(LxScriptItem item)
        {
            object objComponet = item.getComponent();
            RepoItemInfo objComponetInfo = item.getComponentInfo();
            Type objType = objComponet.GetType();

            //MessageBox.Show(objType.Name.ToString());

            if(objType.Name.ToString() == "List")
            {
                RepoItemInfo targetListItemInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableListItem",
                                                                   objComponetInfo.Path + "/listitem[@accessiblename='"+ item.getArgText() +"']",
                                                                   10000, null, System.Guid.NewGuid().ToString());
                Ranorex.ListItem targetListItem = targetListItemInfo.CreateAdapter<Ranorex.ListItem>(true);
                targetListItem.Click();
            }

            if(objType.Name.ToString() == "Table")
            {
                RepoItemInfo targetCellInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableCell",
                                                                   objComponetInfo.Path + "/row/cell[@text='"+ item.getArgText() +"']",
                                                                   10000, null, System.Guid.NewGuid().ToString());
                Ranorex.Cell targetCell = targetCellInfo.CreateAdapter<Ranorex.Cell>(true);
                targetCell.Click();
            }

            if(objType.Name.ToString() == "Tree")
            {

                String Xpos = " ";
                String Ypos = " ";
                String sPoint ="0;0";

                if((!(item.getArg3Text().Trim().Equals("")))&&(!(item.getArg4Text().Trim().Equals(""))))
                {
                    Xpos = item.getArg3Text();
                    Ypos = item.getArg4Text();
                    sPoint =Xpos+";"+Ypos;
                }

                int treeLevel = Convert.ToInt32(item.getArgText());
                string strTreelevel = "";
                string strTreelevelCkb = "";
                for(int i = 1 ; i <= treeLevel; i++)
                {
                    strTreelevel += "/treeitem";
                    strTreelevelCkb += "/checkbox";
                }

                RepoItemInfo targetTreeItemInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableTreeItem",
                                                                   objComponetInfo.Path + strTreelevel +"[@accessiblename='"+ item.getArg2Text() +"']",
                                                                   10000, null, System.Guid.NewGuid().ToString());

                if(targetTreeItemInfo.Exists())
                {
                    Ranorex.TreeItem targetTreeItem = targetTreeItemInfo.CreateAdapter<Ranorex.TreeItem>(true);

                    targetTreeItem.Click(sPoint);
                }
                else
                {
                    targetTreeItemInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableTreeItem1",
                                                                   objComponetInfo.Path + strTreelevelCkb +"[@accessiblename='"+ item.getArg2Text() +"']",
                                                                   10000, null, System.Guid.NewGuid().ToString());
                    Ranorex.CheckBox targetTreeItemCkb = targetTreeItemInfo.CreateAdapter<Ranorex.CheckBox>(true);
                    targetTreeItemCkb.Click(sPoint);
                }

            }
        }
コード例 #9
0
ファイル: LxGenericAction.cs プロジェクト: YouwenYao/Alex
 //**********************************************************************
 /// <summary>
 /// RightClick to given items in the comoponet like Container.
 /// </summary>
 public static void RightClick_Item(LxScriptItem item)
 {
     object objComponet = item.getComponent();
     RepoItemInfo objComponetInfo = item.getComponentInfo();
     Type objType = objComponet.GetType();
     if(objType.Name.ToString() == "Container")
     {
         Ranorex.Container targetContainer = objComponetInfo.CreateAdapter<Ranorex.Container>(true);
         targetContainer.Click(System.Windows.Forms.MouseButtons.Right);
         // Mouse.ButtonDown(System.Windows.Forms.MouseButtons.Right);
     }
 }
コード例 #10
0
ファイル: LxGenericAction.cs プロジェクト: YouwenYao/Alex
        //**********************************************************************
        /// <summary>
        /// Move mouse to given items in the comoponet like List, Table and Tree.
        /// </summary>
        public static void MoveTo(LxScriptItem item)
        {
            object objComponet = item.getComponent();
            RepoItemInfo objComponetInfo = item.getComponentInfo();
            Type objType = objComponet.GetType();

            //MessageBox.Show(objType.Name.ToString());

            if(objType.Name.ToString() == "List")
            {
                RepoItemInfo targetListItemInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableListItem",
                                                                   objComponetInfo.Path + "/listitem[@accessiblename='"+ item.getArgText() +"']",
                                                                   10000, null, System.Guid.NewGuid().ToString());
                Ranorex.ListItem targetListItem = targetListItemInfo.CreateAdapter<Ranorex.ListItem>(true);
                targetListItem.MoveTo();
            }

            if(objType.Name.ToString() == "Table")
            {
                RepoItemInfo targetCellInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableCell",
                                                                   objComponetInfo.Path + "/row/cell[@text='"+ item.getArgText() +"']",
                                                                   10000, null, System.Guid.NewGuid().ToString());
                Ranorex.Cell targetCell = targetCellInfo.CreateAdapter<Ranorex.Cell>(true);
                targetCell.MoveTo();
            }

            if(objType.Name.ToString() == "Tree")
            {
                int treeLevel = Convert.ToInt32(item.getArgText());
                string strTreelevel = "";
                for(int i = 1 ; i <= treeLevel; i++)
                {
                    strTreelevel += "/treeitem";
                }
                RepoItemInfo targetTreeItemInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableTreeItem",
                                                                   objComponetInfo.Path + strTreelevel +"[@accessiblename='"+ item.getArg2Text() +"']",
                                                                   10000, null, System.Guid.NewGuid().ToString());
                Ranorex.TreeItem targetTreeItem = targetTreeItemInfo.CreateAdapter<Ranorex.TreeItem>(true);
                targetTreeItem.MoveTo();
            }
        }
コード例 #11
0
ファイル: LxGenericAction.cs プロジェクト: YouwenYao/Alex
        //**********************************************************************
        /// <summary>
        /// Input Cell by given index in the Table.
        /// </summary>
        public static void Input_Cell(LxScriptItem item)
        {
            object objComponet = item.getComponent();
            RepoItemInfo objComponetInfo = item.getComponentInfo();
            Type objType = objComponet.GetType();

            if(objType.Name.ToString() == "Table")
            {
                Ranorex.Table tb = (Ranorex.Table)objComponet;
                tb.Rows[Convert.ToInt32(item.getArgText())].Cells[Convert.ToInt32(item.getArg2Text())].DoubleClick();
                Keyboard.Press("{CONTROL down}{Akey}{CONTROL up}"+item.getArg3Text());
            }
        }
コード例 #12
0
ファイル: LxGenericAction.cs プロジェクト: YouwenYao/Alex
        //**********************************************************************
        /// <summary>
        /// Execute one command, parse the command.
        /// </summary>
        public static bool executeCommand(LxScriptItem item)
        {
            if(item.m_Type == "F")
            {
                return executeFormCommand(item);
            }

            if(item.m_Type == "C" && item.m_WindowName == "Pause")
            {
                Delay.Milliseconds(Convert.ToInt32(item.m_Component) * 1000);
                return true;
            }

            if(item.m_Type == "C" && item.m_WindowName == "VerifyTxtfileValues")
            {
                VerifyTxtfileValues(item);
                return true;
            }

            if(item.m_Type == "C" && item.m_WindowName == "VerifyExcelfileValues")
            {
                VerifyExcelfileValues(item);
                return true;
            }

            if(item.m_Type == "C" && item.m_WindowName == "SendCommandToSimulator")
            {
                SendCommandToSimulator(item);
                return true;
            }

            if(item.m_Type == "C" && item.m_WindowName == "CopyDataToFile")
            {
                CopyDataToFile(item);
                return true;
            }

            if(item.m_Type == "C" && item.m_WindowName == "LaunchApplication")
            {
                AppStart(item);
                return true;
            }

            if(item.m_Type == "C" && item.m_WindowName == "DeleteLocalFile")
            {

                DeleteLocalFile(item);
                return true;
            }

            if(item.m_Type == "C" && item.m_WindowName == "CloseApplication")
            {
                AppClose(item);
                return true;
            }

            if(item.m_Type.Substring(0,1) == ";")
            {
                return true;
            }

            if(item.m_Action == "Exists")
            {
                Validate.Exists(item.getComponentInfo());
                return true;
            }

            if(item.m_Action == "NotExists")
            {
                Validate.NotExists(item.getComponentInfo());
                return true;
            }

            if(item.m_Action == "VerifyProperty")
            {
                //PropertyInfo property = objType.GetProperty(item.m_Arg1);
                //property.GetValue(objComponet, null).ToString();
                //Validate.Attribute(item.getComponentInfo(),item.m_Arg1,item.m_Arg2);
                //Validate.Attribute(
                VerifyProperty(item);
                return true;
            }

            object[] arg = (object[])m_ActionMap[item.m_Action];
            MethodInfo method = null;
            object[] parameters = null;

            if(arg[1].ToString() == "S2")
            {
                repo.myCustom = item.getArgText();
            }
            if(item.m_Index == "33")
            {
                Delay.Milliseconds(2000);
            }
            object objComponet = item.getComponent();
            RepoItemInfo objComponetInfo = item.getComponentInfo();
            Type objType = objComponet.GetType();

            if(arg[1].ToString() == "0" || arg[1].ToString() == "S2")
            {
                method = objType.GetMethod(arg[0].ToString(),
                                                  new Type[]{});
                parameters = new object[]{};
            }
            if(arg[1].ToString() == "1")
            {
                method = objType.GetMethod(arg[0].ToString(),
                                                  new Type[]{ typeof (string)});
                parameters = new object[]{item.getArgText()};
            }
            if(arg[1].ToString() == "S1")
            {
                PropertyInfo pi = objType.GetProperty(arg[0].ToString());
                pi.SetValue(objComponet,item.getArgText(),null);
                return true;
            }

            if(arg[1].ToString() == "S3")
            {
                method = objType.GetMethod(arg[0].ToString(),
                                                  new Type[]{typeof (string)});
                parameters = new object[]{item.getArgText()};
                PropertyInfo pi = objType.GetProperty("TextValue")!=null?objType.GetProperty("TextValue"):objType.GetProperty("Text");
                pi.SetValue(objComponet,"",null);
            }

            if(arg[1].ToString() == "S4")
            {
                Select_Item(item);
                return true;
            }

            if(arg[1].ToString() == "S5")
            {
                method = objType.GetMethod(arg[0].ToString(),
                                                  new Type[]{ });
                parameters = new object[]{};
                method.Invoke(objComponet,parameters);
                Delay.Milliseconds(1500);
                Validate.AreEqual(Ranorex.ToolTip.Current.Text,item.getArgText());
                return true;
            }

            if(arg[1].ToString() == "S6")
            {
                VerifyContains(item);
                return true;
            }

            if(arg[1].ToString() == "S7")
            {
                VerifyNotContains(item);
                return true;
            }

            if(arg[1].ToString() == "S8")
            {
                MoveTo(item);
                return true;
            }

            if(arg[1].ToString() == "S9")
            {
                Click_Cell(item);
                return true;
            }

            if(arg[1].ToString() == "S10")
            {
                DoubleClick_Item(item);
                return true;
            }

            if(arg[1].ToString() == "S11")
            {
                RightClick_Item(item);
                return true;
            }

            if(arg[1].ToString() == "S12")
            {
                Input_Cell(item);
                return true;
            }

               	method.Invoke(objComponet,parameters);
               	return true;
        }
コード例 #13
0
ファイル: LxGenericAction.cs プロジェクト: YouwenYao/Alex
        //**********************************************************************
        /// <summary>
        /// DoubleClick to given items in the comoponet like List, Table and Tree.
        /// </summary>
        public static void DoubleClick_Item(LxScriptItem item)
        {
            object objComponet = item.getComponent();
            RepoItemInfo objComponetInfo = item.getComponentInfo();
            Type objType = objComponet.GetType();

            //MessageBox.Show(objType.Name.ToString());

            if(objType.Name.ToString() == "List")
            {
                RepoItemInfo targetListItemInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableListItem",
                                                                   objComponetInfo.Path + "/listitem[@accessiblename='"+ item.getArgText() +"']",
                                                                   10000, null, System.Guid.NewGuid().ToString());
                Ranorex.ListItem targetListItem = targetListItemInfo.CreateAdapter<Ranorex.ListItem>(true);
                targetListItem.DoubleClick();
            }

            if(objType.Name.ToString() == "Table")
            {
                RepoItemInfo targetCellInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableCell",
                                                                   objComponetInfo.Path + "/row/cell[@text='"+ item.getArgText() +"']",
                                                                   10000, null, System.Guid.NewGuid().ToString());
                Ranorex.Cell targetCell = targetCellInfo.CreateAdapter<Ranorex.Cell>(true);
                targetCell.DoubleClick();
            }

            if(objType.Name.ToString() == "Tree")
            {
                int treeLevel = Convert.ToInt32(item.getArgText());
                string strTreelevel = "";
                for(int i = 1 ; i <= treeLevel; i++)
                {
                    strTreelevel += "/treeitem";
                }
                RepoItemInfo targetTreeItemInfo = new RepoItemInfo(objComponetInfo.ParentFolder, "variableTreeItem",
                                                                   objComponetInfo.Path + strTreelevel +"[@accessiblename='"+ item.getArg2Text() +"']",
                                                                   10000, null, System.Guid.NewGuid().ToString());
                Ranorex.TreeItem targetTreeItem = targetTreeItemInfo.CreateAdapter<Ranorex.TreeItem>(true);
                targetTreeItem.DoubleClick();
               /*
                Ranorex.Control treeViewControl = targetTreeItem.Element.As<Ranorex.Control>();
                System.Windows.Forms.TreeNode node = treeViewControl.InvokeMethod(
                                "GetNodeAt",
                                new object[] { targetTreeItem.Element.ClientRectangle.Location + new Size(1, 1) })
                                    as System.Windows.Forms.TreeNode;
                object mynode = node.GetLifetimeService();
                Ranorex.CheckBox mycheckbox = (Ranorex.CheckBox)mynode;
                mycheckbox.Check();
            */

            }
        }
コード例 #14
0
ファイル: LxGenericAction.cs プロジェクト: YouwenYao/Alex
        //**********************************************************************
        /// <summary>
        /// Click to the Cell by given index in the Table.
        /// </summary>
        public static void Click_Cell(LxScriptItem item)
        {
            object objComponet = item.getComponent();
            RepoItemInfo objComponetInfo = item.getComponentInfo();
            Type objType = objComponet.GetType();

            if(objType.Name.ToString() == "Table")
            {
                Ranorex.Table tb = (Ranorex.Table)objComponet;
                tb.Rows[Convert.ToInt32(item.getArgText())].Cells[Convert.ToInt32(item.getArg2Text())].Click();
            }
        }
コード例 #15
0
ファイル: LxGenericAction.cs プロジェクト: YouwenYao/private
 //**********************************************************************
 /// <summary>
 /// Form action: VerifyProperty equal, Contains, NotContains.
 /// </summary>
 public static void VerifyProperty(LxScriptItem item)
 {
     if(item.getArg2Text() == "Equal")
     {
         Validate.Attribute(item.getComponentInfo(), item.getArgText(), item.getArg3Text());
     }
     if(item.getArg2Text() == "Contains")
     {
         Validate.Attribute(item.getComponentInfo(), item.getArgText(), new Regex(Regex.Escape(item.getArg3Text())));
     }
     if(item.getArg2Text() == "NotContains")
     {
         Validate.Attribute(item.getComponentInfo(), item.getArgText(), new Regex("^((?!("+Regex.Escape(item.getArg3Text())+")).)*$"));
     }
 }