本文整理汇总了C#中WinWindow.GetChildren方法的典型用法代码示例。如果您正苦于以下问题:C# WinWindow.GetChildren方法的具体用法?C# WinWindow.GetChildren怎么用?C# WinWindow.GetChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WinWindow
的用法示例。
在下文中一共展示了WinWindow.GetChildren方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCUITList
public WinList GetCUITList(WinWindow w, string searchBy, string searchValue, int index)
{
Console.WriteLine("Inside function GetCUITList");
WinList GetCUITList = new WinList(w);
try
{
Playback.Initialize();
switch (searchBy.Trim().ToLower())
{
case "text":
{
if (index == -1)
{
GetCUITList.SearchProperties[WinList.PropertyNames.Name] = searchValue;
}
else
{
GetCUITList.SearchProperties.Add(WinList.PropertyNames.Name, searchValue);
UITestControlCollection checkboxCollection = GetCUITList.FindMatchingControls();
GetCUITList = (WinList)checkboxCollection[index];
}
break;
}
case "automationid":
{
if (index == -1)
{
GetCUITList.SearchProperties.Add(WinList.PropertyNames.ControlName, searchValue);
UITestControlCollection checkboxCollection = GetCUITList.FindMatchingControls();
GetCUITList = (WinList)checkboxCollection[0];
}
else
{
GetCUITList.SearchProperties.Add(WinList.PropertyNames.ControlName, searchValue);
UITestControlCollection checkboxCollection = GetCUITList.FindMatchingControls();
GetCUITList = (WinList)checkboxCollection[index];
}
break;
}
case "notext":
{
UITestControlCollection checkboxCollection = w.GetChildren();
for (int i = 0; i < checkboxCollection.Count; i++)
{
UITestControl control = checkboxCollection[i];
if (control.ControlType.ToString().ToLower() == "winlist")
{
GetCUITList = (WinList)control;
}
}
break;
}
default:
throw new Exception(_error);
}
Playback.Cleanup();
Console.WriteLine("Found List and exiting function GetCUITList");
return GetCUITList;
}
catch (Exception e)
{
var st = new StackTrace(e, true);
var testFrame = st.GetFrame(0);
for (int i = 0; i < st.FrameCount; i++)
{
testFrame = st.GetFrame(i);
if (testFrame.GetFileName() != null)
{
if (testFrame.GetFileName().ToString().Contains("CUITFramework.cs") == true)
{
break;
}
}
}
// Get the top stack frame
var frame = testFrame;
// Get the line number from the stack frame
var line = frame.GetFileLineNumber();
logTofile(_eLogPtah, "Error in GetCUITCHeckbox and in line: " + line);
throw new Exception(_error + "CUITRButton:" + System.Environment.NewLine + e.Message);
}
}
示例2: SearchWellWinControls
public UITestControl SearchWellWinControls(string ControlName)
{
WinWindow SearchWellWin = new WinWindow();
SearchWellWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
SearchWellWin.SearchProperties.Add(WinWindow.PropertyNames.ClassName, "#32770");
SearchWellWin.SearchProperties.Add(WinWindow.PropertyNames.Name, "Search Well");
WinWindow SearchWellWinEdit = new WinWindow(SearchWellWin);
SearchWellWinEdit.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
SearchWellWinEdit.SearchProperties.Add(WinWindow.PropertyNames.ControlId, "1007");
WinWindow OKButtonWindow = new WinWindow(SearchWellWin);
OKButtonWindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
OKButtonWindow.SearchProperties.Add(WinWindow.PropertyNames.ControlId, "1");
//IEnumerable<WinButton> Test = OKButtonWindow.GetChildren().OfType<WinButton>();
UITestControl ReturnThis = new UITestControl();
switch (ControlName)
{
case "SearchTxtBox":
{
ReturnThis = SearchWellWinEdit.GetChildren().OfType<WinEdit>().First();
break;
}
case "OKButton":
{
WinButton OKButton = new WinButton(OKButtonWindow);
OKButton.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
OKButton.SearchProperties.Add(WinWindow.PropertyNames.Name, "OK");
ReturnThis = OKButton;
break;
}
}
return ReturnThis;
}
示例3: MOPAddWellStatusWin
public void MOPAddWellStatusWin(string ComboBox, string CBValue, string WellName)
{
WinWindow MOPAddWellStatWin = new WinWindow();
MOPAddWellStatWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
MOPAddWellStatWin.SearchProperties.Add(WinWindow.PropertyNames.ClassName, "#32770");
MOPAddWellStatWin.SearchProperties.Add(WinWindow.PropertyNames.Name, "Add Well Status/MOP/Type History to Selected Well");
#region CB
switch (ComboBox)
{
case "NewStatus":
{
WinWindow NewStatusComboWin = new WinWindow(MOPAddWellStatWin);
NewStatusComboWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.ControlName, "combo");
NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.Instance, "3"); // New Status CB
NewStatusComboWin.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well");
WinComboBox NewStatusComboBox = NewStatusComboWin.GetChildren().OfType<WinComboBox>().First();
WinWindow ComboBoxWindow = new WinWindow();
ComboBoxWindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
ComboBoxWindow.SearchProperties[WinWindow.PropertyNames.Name] = "ComboBox";
ComboBoxWindow.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains));
ComboBoxWindow.WindowTitles.Add("ComboBox");
WinWindow UIListWin = new WinWindow(ComboBoxWindow);
UIListWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
UIListWin.SearchProperties[WinWindow.PropertyNames.ControlName] = "list";
UIListWin.WindowTitles.Add("ComboBox");
if (NewStatusComboBox.SelectedItem != CBValue)
{
//Mouse.Click(NewStatusComboBox);
// NewStatusComboBox.Expanded = true;
//WinList List = new WinList(UIListWin);
//List.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
//List.WindowTitles.Add("ComboBox");
//string[] Items = List.SelectedItems;
//foreach (string item in Items)
//{
// if (item == CBValue)
// {
// WinListItem ItemToClick = new WinListItem(UIListWin);
// ItemToClick.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
// ItemToClick.SearchProperties.Add(WinListItem.PropertyNames.Name, item);
// Mouse.Click(ItemToClick);
// }
//}
while (NewStatusComboBox.SelectedItem != CBValue)
{
Mouse.Click(NewStatusComboBox);
Trace.WriteLine("Clicked Status Combo Box");
//NewStatusComboBox.Expanded = true;
//Trace.WriteLine("Expanded Status Combo Box");
System.Threading.Thread.Sleep(5000);
WinList List = new WinList(UIListWin);
List.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
List.WindowTitles.Add("ComboBox");
WinListItem Item = new WinListItem(UIListWin);
Item.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
Item.SearchProperties.Add(WinListItem.PropertyNames.Name, CBValue);
if (UIListWin.Exists && Item.Exists)
{
// List.SelectedItemsAsString = CBValue;
Mouse.Hover(Item);
Trace.WriteLine("Mouse Hover on item " + Item);
//System.Threading.Thread.Sleep(3000);
Mouse.DoubleClick(Item);
Trace.WriteLine("Double Click " + Item);
}
}
}
Assert.IsTrue(NewStatusComboBox.SelectedItem == CBValue, "Combox value : " + NewStatusComboBox.SelectedItem.ToString() + " Does NOT EQUAL " + CBValue + " the correct item was not set");
break;
}
case "MOP":
{
WinWindow NewStatusComboWin = new WinWindow(MOPAddWellStatWin);
NewStatusComboWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.ControlName, "combo");
NewStatusComboWin.SearchProperties.Add(WinWindow.PropertyNames.Instance, "2"); // MOP CB
NewStatusComboWin.WindowTitles.Add("Add Well Status/MOP/Type History to Selected Well");
WinComboBox NewStatusComboBox = NewStatusComboWin.GetChildren().OfType<WinComboBox>().First();
WinWindow ComboBoxWindow = new WinWindow();
ComboBoxWindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
ComboBoxWindow.SearchProperties[WinWindow.PropertyNames.Name] = "ComboBox";
ComboBoxWindow.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains));
ComboBoxWindow.WindowTitles.Add("ComboBox");
WinWindow UIListWin = new WinWindow(ComboBoxWindow);
UIListWin.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
UIListWin.SearchProperties[WinWindow.PropertyNames.ControlName] = "list";
//.........这里部分代码省略.........