예제 #1
0
 public static bool ClickThis(this Ranorex.ListItem item)
 {
     System.Threading.Thread.Sleep(200);
     item.Click();
     System.Threading.Thread.Sleep(200);
     return(true);
 }
예제 #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
        public static void Select(this Ranorex.ComboBox combobox, string item)
        {
            // create button
            Ranorex.Button mybutton = combobox.FindSingle(combobox.GetPath().ToString() + "/button[@accessiblename='Open' or @text='>']");
            mybutton.Click();

            // create list item to click on
            Ranorex.ListItem myList = combobox.FindSingle(String.Format("/list[@controlid='1000']/listitem[@text='{0}']", item));
            myList.Click();
        }
예제 #4
0
 public static void ClickThis(this Ranorex.ListItem item)
 {
     try
     {
         item.Click();
         Sleep();
     }
     catch (Exception ex)
     {
         throw new Exception("ListItem Click Failed : " + ex.Message);
     }
 }