本文整理汇总了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);
}
示例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;
}
示例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");
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}