当前位置: 首页>>代码示例>>C#>>正文


C# UITestControl.FindMatchingControls方法代码示例

本文整理汇总了C#中UITestControl.FindMatchingControls方法的典型用法代码示例。如果您正苦于以下问题:C# UITestControl.FindMatchingControls方法的具体用法?C# UITestControl.FindMatchingControls怎么用?C# UITestControl.FindMatchingControls使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UITestControl的用法示例。


在下文中一共展示了UITestControl.FindMatchingControls方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoginUserAndShowHomeOld

        public void LoginUserAndShowHomeOld()
        {
            // Entsprechenden Testdatensatz generieren
            var user = new User("eric", "password");

            // Login-Elemente suchen udn füllen
            var usrTxtBox = new UITestControl();
            var pwTxtBox = new UITestControl();
            var btn = new UITestControl();

            // searchproperties hinzufügen und element suchen
            usrTxtBox.SearchProperties.Add("AutomationId", "username",PropertyExpressionOperator.EqualTo);
            usrTxtBox = usrTxtBox.FindMatchingControls()[0];

            // searchproperties hinzufügen und element suchen
            pwTxtBox.SearchProperties.Add("AutomationId", "password", PropertyExpressionOperator.EqualTo);
            pwTxtBox = pwTxtBox.FindMatchingControls()[0];

            // searchproperties hinzufügen und element suchen
            btn.SearchProperties.Add("AutomationId", "loginbtn", PropertyExpressionOperator.EqualTo);
            btn = btn.FindMatchingControls()[0];

            // Setze entsprechende Werte
            usrTxtBox.SetProperty("Text", user.Name);
            pwTxtBox.SetProperty("Text", user.Password);

            // LoginButton Clicken
            Mouse.Click(btn);

            // Die Willkommen-Message suchen und entsprechend verifizieren
            var welcomemsg = new UITestControl();
            welcomemsg.SearchProperties.Add("AutomationId", "welcomemsg", PropertyExpressionOperator.EqualTo);

            StringAssert.Contains(welcomemsg.GetProperty("Text").ToString(), "Willkommen, eric");
        }
开发者ID:erickubenka,项目名称:code-examples,代码行数:35,代码来源:HomeTest.cs

示例2: GetCUITEdit

        public WinEdit GetCUITEdit(WinWindow w, string searchBy, string searchValue, int index)
        {
            Console.WriteLine("Inside function GetCUITEdit");
            Playback.Initialize();
            UITestControl cntl = new UITestControl(w);
            cntl.TechnologyName = "MSAA";
            cntl.SearchProperties.Add("ControlType", "Edit");
               // WinEdit GetCUITEdit = new WinEdit(w);
            WinEdit GetCUITEdit = null;

            try
            {

                switch (searchBy.Trim().ToLower())
                {
                    case "text":
                        {
                            if (index == -1)
                            {
                               // GetCUITEdit.SearchProperties[WinEdit.PropertyNames.Name] = searchValue;

                                cntl.SearchProperties.Add("Name", searchValue);
                                UITestControlCollection editCollection = cntl.FindMatchingControls();
                                GetCUITEdit = (WinEdit)editCollection[0];
                            }
                            else
                            {
                                //GetCUITEdit.SearchProperties.Add(WinEdit.PropertyNames.Name, searchValue);
                                //UITestControlCollection editCollection = GetCUITEdit.FindMatchingControls();
                                //GetCUITEdit = (WinEdit)editCollection[index];
                                cntl.SearchProperties.Add("ControlType", "Edit");
                                cntl.SearchProperties.Add("Name", searchValue);
                                UITestControlCollection editCollection = cntl.FindMatchingControls();
                                GetCUITEdit = (WinEdit)editCollection[index];
                            }
                            break;
                        }

                    case "automationid":
                        {
                            if (index == -1)
                            {
                                //GetCUITEdit.SearchProperties.Add(WinEdit.PropertyNames.ControlName, searchValue);
                                //UITestControlCollection editCollection = GetCUITEdit.FindMatchingControls();
                                //GetCUITEdit = (WinEdit)editCollection[0];

                                UITestControlCollection editCollection = cntl.FindMatchingControls();
                               int i = 0;
                                foreach (UITestControl edt in editCollection)
                                {
                                    if (((WinEdit)edt).ControlName == searchValue)
                                    {
                                        GetCUITEdit = (WinEdit)edt;
                                        break;
                                    }
                                    i++;
                                }

                            }
                            else
                            {
                                //GetCUITEdit.SearchProperties.Add(WinEdit.PropertyNames.ControlName, searchValue);
                                //UITestControlCollection editCollection = GetCUITEdit.FindMatchingControls();
                                //GetCUITEdit = (WinEdit)editCollection[index];

                                UITestControlCollection editCollection = cntl.FindMatchingControls();
                                int i = 0;
                                int j = 0;
                                foreach (UITestControl edt in editCollection)
                                {
                                    if ( ((WinEdit)edt).ControlName == searchValue && j==index)
                                    {
                                        GetCUITEdit = (WinEdit)edt;
                                        j++;
                                        break;
                                    }
                                    i++;
                                }

                            }
                            break;
                        }
                    case "notext":
                        {
                            if (index == -1)
                            {
                                UITestControlCollection editCollection = cntl.FindMatchingControls();
                                GetCUITEdit = (WinEdit)editCollection[0];
                            }
                            else
                            {
                                UITestControlCollection editCollection = cntl.FindMatchingControls();
                                GetCUITEdit = (WinEdit)editCollection[index];
                            }

                            break;
                        }

                    default:
                        throw new Exception(_error);
//.........这里部分代码省略.........
开发者ID:prasannarhegde2015,项目名称:DocumentsEJ2012,代码行数:101,代码来源:CUITFramework.cs

示例3: GetWorkflowSteps

 public UITestControlCollection GetWorkflowSteps(UITestControl theWorkflow, string controlId)
 {
     var stepSearcher = new UITestControl(theWorkflow);
     stepSearcher.SearchProperties.Add("AutomationId", controlId, PropertyExpressionOperator.Contains);
     UITestControlCollection steps = stepSearcher.FindMatchingControls();
     return steps;
 }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:7,代码来源:OutputUIMap.cs

示例4: getControl

 UITestControl getControl(ControlType controlType, BrowserWindow browser, string buttonId)
 {
     UITestControl button = new UITestControl(browser);
        button.TechnologyName = "Web";
        var controlTypeString = controlType.ToString();
        button.SearchProperties.Add("ControlType", controlTypeString);
        button.SearchProperties.Add("Id", buttonId);
        var buttons = button.FindMatchingControls();
        button.Find();
        return button;
 }
开发者ID:Jassbrain,项目名称:jassplan,代码行数:11,代码来源:JpBigTest.cs


注:本文中的UITestControl.FindMatchingControls方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。