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


C# UITestControl.GetProperty方法代码示例

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


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

示例1: GetChildByAutomationIDPathImpl

        private UITestControl GetChildByAutomationIDPathImpl(UITestControl parent, int bookmark, params string[] automationIDs)
        {
            //Find all children
            var children = parent.GetChildren();
            if(children == null)
            {
                try
                {
                    throw new UITestControlNotFoundException("Cannot find children of " + parent.GetProperty("AutomationID") +
                        " and friendly name: " + parent.FriendlyName +
                        " and control type: " + parent.ControlType +
                        " and class name: " + parent.ClassName + ".");
                }
                catch(NullReferenceException)
                {
                    throw new UITestControlNotFoundException("Cannot find children of " + parent.GetProperty("AutomationID") + ".");
                }
            }

            //Find some child
            var firstChildFound = children.FirstOrDefault(child =>
                {
                    var childId = child.GetProperty("AutomationID");
                    if(childId != null)
                    {
                        var childAutoId = childId.ToString();
                        return childAutoId.Contains(automationIDs[bookmark])
                            || child.FriendlyName.Contains(automationIDs[bookmark])
                            || child.ControlType.Name.Contains(automationIDs[bookmark])
                            || child.ClassName.Contains(automationIDs[bookmark]);
                    }
                    return false;
                });
            if(firstChildFound == null)
            {
                throw new UITestControlNotFoundException("Cannot find " + automationIDs[bookmark] +
                    " control within parent" +
                    " with automation ID: " + parent.GetProperty("AutomationID") +
                    " and friendly name: " + parent.FriendlyName +
                    " and control type: " + parent.ControlType +
                    " and class name: " + parent.ClassName + ".");
            }

            //Return child or some child of child...
            return bookmark == automationIDs.Count() - 1 ? firstChildFound : GetChildByAutomationIDPathImpl(firstChildFound, ++bookmark, automationIDs);
        }
开发者ID:FerdinandOlivier,项目名称:Warewolf-ESB,代码行数:46,代码来源:VisualTreeWalker.cs

示例2: GetValueProperty

 public static string GetValueProperty(UITestControl control)
 {
     string value = control.GetProperty(WinCell.PropertyNames.Value) as string;
     return string.Equals(value, Constants.NullInGrid, StringComparison.OrdinalIgnoreCase) ? string.Empty : value;
 }
开发者ID:herno,项目名称:CodedUITestProject,代码行数:5,代码来源:GridViewUtilities.cs

示例3: 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

示例4: SetText

 public static void SetText(UITestControl control, string text)
 {
     control.WaitForControlReady();
     control.SetFocus();
     MouseClickOnCoordinates(control);
     if (!control.GetProperty("Value").Equals(null))
     {
         SendKeys.SendWait("^A");
         SendKeys.SendWait("{DELETE}");
     }
     SendKeys.SendWait("{HOME}");
     Playback.Wait(1000);
     SendKeys.SendWait(text);
 }
开发者ID:k3foru,项目名称:WinAppTestingFramework,代码行数:14,代码来源:Actions.cs

示例5: ValidateObjectProperty

        private string ValidateObjectProperty(UITestControl element, string propertyName)
        {
            string attributeValue = "";

               try
               {
               attributeValue = element.GetProperty(propertyName).ToString(); ;

               if (attributeValue == null)
               {
                  throw new Exception("Attribute " + propertyName);
               }
            }
            catch (Exception e1)
            {

                throw new Exception("Attribute " + propertyName, e1);
            }
            return attributeValue;
        }
开发者ID:VTAF,项目名称:VirtusaCodedUIRuntime,代码行数:20,代码来源:CodedUITestBase.cs

示例6: CheckAttributePresent

        //-------------------------
        private bool CheckAttributePresent(UITestControl element, string propertyName)
        {
            bool isAttributePresent;

            if (String.Equals("textContent", propertyName, StringComparison.OrdinalIgnoreCase))
            {
                String textValue = element.GetProperty("Text").ToString();
                if ("".Equals(textValue) || textValue == null)
                {
                    isAttributePresent = false;
                }
                else
                {
                    isAttributePresent = true;
                }
            }
            else
            {
                if (element.GetProperty(propertyName.ToUpper()) != null)
                {
                    isAttributePresent = true;
                }
                else
                {
                    isAttributePresent = false;
                }
            }
            return isAttributePresent;
        }
开发者ID:VTAF,项目名称:VirtusaCodedUIRuntime,代码行数:30,代码来源:CodedUITestBase.cs

示例7: SearchItem

        /// <summary>
        /// This method is to Select Service provider in create new work order
        /// parm BrowerWindow passing window object
        /// </summary>
        public string SearchItem(string serialNo, BrowserWindow window)
        {
            string error;
            _serialNo.SetProperty("Text", serialNo);
            _serchIcon.Click();

            UITestControl errorMessage = new UITestControl(window);
            errorMessage.TechnologyName = "Web";
            errorMessage.SearchProperties.Add("ControlType", "Pane", "Id", "SerialNo_validationMessage");
            error = errorMessage.GetProperty("InnerText").ToString();
            return error;
        }
开发者ID:rangaabyeti,项目名称:HoneywellFirst,代码行数:16,代码来源:WorkOrderPage.cs

示例8: GetCellInfo

        /// <summary>
        /// Gets the cell info from the actual UITestControl.
        /// </summary>
        /// <param name="uiTestControl">The UITestControl.</param>
        /// <returns>The cell info.</returns>
        private static ExcelCellInfo GetCellInfo(UITestControl uiTestControl)
        {
            // Get the ExcelCellElement first.
            ExcelCellElement cellElement = uiTestControl.GetProperty(UITestControl.PropertyNames.UITechnologyElement) as ExcelCellElement;
            if (cellElement != null)
            {
                return cellElement.CellInfo;
            }

            return null;
        }
开发者ID:k3foru,项目名称:excel,代码行数:16,代码来源:ExcelPropertyProvider.cs


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