本文整理汇总了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");
}
示例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);
//.........这里部分代码省略.........
示例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;
}
示例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;
}