本文整理汇总了C#中TestStack.White.UIItems.WindowItems.Window.Get方法的典型用法代码示例。如果您正苦于以下问题:C# Window.Get方法的具体用法?C# Window.Get怎么用?C# Window.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestStack.White.UIItems.WindowItems.Window
的用法示例。
在下文中一共展示了Window.Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SelectListBoxItemByText
//**************************************************************************************************************************************************************
public static void SelectListBoxItemByText(Window win, String listBoxElementAutoID, String matchText)
{
try
{
TestStack.White.UIItems.ListBoxItems.ListBox l = win.Get<TestStack.White.UIItems.ListBoxItems.ListBox>(SearchCriteria.ByAutomationId(listBoxElementAutoID));
List<TestStack.White.UIItems.ListBoxItems.ListItem> k = l.Items;
foreach (var item in k)
{
if (item.Text.Equals(matchText) || item.Text.Contains(matchText))
{
item.Focus();
//item.SetValue(matchText);
item.Click();
Thread.Sleep(int.Parse(Execution_Speed));
}
}
}
catch (Exception e)
{
String sMessage = e.Message;
LastException.SetLastError(sMessage);
throw new Exception(sMessage);
}
}
示例2: LoginModel
public LoginModel(Window loginWindow)
{
loginTextBox = loginWindow.Get<TextBox>(SearchCriteria.ByAutomationId(LoginWindowIDs.LOGINTEXTBOX));
passwordField = loginWindow.Get<TextBox>(SearchCriteria.ByAutomationId(LoginWindowIDs.PASSWORDTEXTBOX));
clientField = loginWindow.Get<TextBox>(SearchCriteria.ByAutomationId(LoginWindowIDs.CLIENDTEXTBOX));
rememberMeCheckBox = loginWindow.Get<CheckBox>(SearchCriteria.ByClassName(LoginWindowIDs.REMEMBERMECHECKBOX));
loginButton = loginButton = loginWindow.Get<Button>(SearchCriteria.ByAutomationId(LoginWindowIDs.LOGINBUTTON));
}
示例3: DeskSelectionModel
public DeskSelectionModel(Window window)
{
deskSelection = window.Get<ComboBox>(SearchCriteria.ByAutomationId(DeskSelectionIDs.DESKSELECTIONCOMBOBOX));
makeMeImmediatlyAvailable = window.Get<CheckBox>(SearchCriteria.ByAutomationId(DeskSelectionIDs.MAKEMEIMMEDIATELYAVAILABLECHECKBOX));
okButton = window.Get<Button>(SearchCriteria.ByAutomationId(DeskSelectionIDs.OKBUTTON));
cancelButton = window.Get<Button>(SearchCriteria.ByAutomationId(DeskSelectionIDs.OKBUTTON));
closeButton = window.Get<Button>(SearchCriteria.ByAutomationId(DeskSelectionIDs.CLOSEBUTTON));
}
示例4: FindControl
/// <summary>
/// given a criteria, find a control within a window
/// </summary>
/// <param name="window">the containing window</param>
/// <param name="criteria">the criteria to find the control</param>
/// <returns>the found control. null - if not found</returns>
public IUIItem FindControl(Window window, Dictionary<string, string> criteria)
{
// the "all" condition
SearchCriteria crit = SearchCriteria.All;
// for each criteria, AND with a new condition
foreach (string key in criteria.Keys)
{
switch (key.ToLower())
{
case Constants.PropertyNames.ControlType:
crit = crit.AndControlType(GetTypeByName(criteria[key]));
break;
case Constants.PropertyNames.AutomationId:
crit = crit.AndAutomationId(criteria[key]);
break;
case Constants.PropertyNames.Text:
crit = crit.AndByText(criteria[key]);
break;
default:
return null;
};
}
// search for control with 'crit'
IUIItem item = window.Get(crit, WaitTime);
// return the found control
return item;
}
示例5: Slide
public void Slide(Window window)
{
var thumb = window.Get<Thumb>("Splitter");
var originalY = thumb.Location.Y;
thumb.SlideVertically(50);
Assert.Equal(originalY + 50, thumb.Location.Y);
}
示例6: Slide
public void Slide(Window window)
{
var thumb = window.Get<Thumb>("Splitter");
double originalX = thumb.Location.X;
thumb.SlideHorizontally(50);
Assert.Equal(originalX + 50, thumb.Location.X);
}
示例7: OperationsPage
public OperationsPage(Window window)
{
this.window = window;
string[] operations = { "*", "/", "-", "+", "=" };
operationButtons = operations.ToDictionary(o => o, o => window.Get<Button>(SearchCriteria.ByText(o)));
}
示例8: ResultPage
public ResultPage(Window window)
{
this.window = window;
var edits = window.GetMultiple(SearchCriteria.ByControlType(ControlType.Edit)).Cast<TextBox>().ToArray();
resultField = edits.First(edit => edit.Text == "0");
resultScreen = edits.First(edit => edit != resultField);
resultButton = window.Get<Button>(SearchCriteria.ByText("="));
okButtonCriteria = SearchCriteria.ByText("OK");
}
示例9: WhiteWindowShim
internal WhiteWindowShim(Window whiteWindow)
{
this._white = whiteWindow;
try
{
if (_white.Exists<Label>())
_text = _white.Get<Label>().Text;
}
catch { }
}
示例10: NumbersPage
public NumbersPage(Window window)
{
var symbolToButtonNameMappings = Enumerable.Range(0, 10)
.Select(i => i.ToString()).Concat(new [] {"." })
.ToDictionary(i => i, i => i);
symbolToButtonNameMappings["-"] = "+/-";
symbolButtons = symbolToButtonNameMappings
.ToDictionary(mapping => mapping.Key,
mapping => window.Get<Button>(SearchCriteria.ByText(mapping.Value)));
}
示例11: CheckElementExistsByAutomationID
//**************************************************************************************************************************************************************
public static bool CheckElementExistsByAutomationID(Window win, String automationID)
{
bool exists = false;
try
{
exists = win.Get(SearchCriteria.ByAutomationId(automationID)).Visible;
Thread.Sleep(int.Parse(Execution_Speed));
return exists;
}
catch (Exception e)
{
String sMessage = e.Message;
LastException.SetLastError(sMessage);
throw new Exception(sMessage);
}
}
示例12: SelectRadioButtonByName
//**************************************************************************************************************************************************************
public static void SelectRadioButtonByName(Window win, String radioButtonName)
{
try
{
AutomationProperty p = AutomationElementIdentifiers.NameProperty;
TestStack.White.UIItems.RadioButton r = win.Get<TestStack.White.UIItems.RadioButton>(SearchCriteria.ByNativeProperty(p, radioButtonName));
r.Select();
Thread.Sleep(int.Parse(Execution_Speed));
}
catch (Exception e)
{
String sMessage = e.Message;
LastException.SetLastError(sMessage);
throw new Exception(sMessage);
}
}
示例13: FindCustomItem
void FindCustomItem(Window window)
{
var myDateUIItem = window.Get<MyDateUIItem>("DateOfBirth");
Assert.NotEqual(null, myDateUIItem);
myDateUIItem.EnterDate(DateTime.Today);
}
示例14: ClickButtonByAutomationID
//**************************************************************************************************************************************************************
public static void ClickButtonByAutomationID(Window win, String automationID)
{
try
{
TestStack.White.UIItems.Button b = (TestStack.White.UIItems.Button) win.Get(SearchCriteria.ByAutomationId(automationID));
b.Click();
Thread.Sleep(int.Parse(Execution_Speed));
}
catch (Exception e)
{
String sMessage = e.Message;
LastException.SetLastError(sMessage);
throw new Exception(sMessage);
}
}
示例15: SelectRadioButton
//**************************************************************************************************************************************************************
public static void SelectRadioButton(Window win, String radioButtonAutoID)
{
try
{
TestStack.White.UIItems.RadioButton r = win.Get<TestStack.White.UIItems.RadioButton>(SearchCriteria.ByAutomationId(radioButtonAutoID));
r.Select();
Thread.Sleep(int.Parse(Execution_Speed));
}
catch (Exception e)
{
String sMessage = e.Message;
LastException.SetLastError(sMessage);
throw new Exception(sMessage);
}
}