本文整理汇总了C#中System.Windows.Automation.AutomationElement.FindChildByControlTypeAndName方法的典型用法代码示例。如果您正苦于以下问题:C# AutomationElement.FindChildByControlTypeAndName方法的具体用法?C# AutomationElement.FindChildByControlTypeAndName怎么用?C# AutomationElement.FindChildByControlTypeAndName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Automation.AutomationElement
的用法示例。
在下文中一共展示了AutomationElement.FindChildByControlTypeAndName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Find
public static GuiFileDialog Find(AutomationElement window, string caption)
{
AutomationElement dlg = null;
//* Works fine on Windows 8.1, but not on Windows 7 with only .Net 4.0 installed.
// * We need to retest this after upgrading to .Net 4.6
int maxRetries = 120;
while (dlg == null && maxRetries > 0) {
try {
//dlg = window.FindChildByLocalizedControlTypeAndName(caption, AutomationExtensions.DialogLocalizedControlNameOptions); //different name options on different language settings
dlg = window.FindChildByControlTypeAndName(ControlType.Window, caption);
} catch (Exception) {
if (maxRetries <= 0)
throw;
}
if (dlg == null && maxRetries % 10 == 0) {
Log.DebugFormat("File dialog not found: {0} Caption: {1}", maxRetries, caption);
}
Thread.Sleep(500);
maxRetries--;
}
//*/
//Until this method gets reworked, let developer-machines sleep for 6 seconds instead of 60, for faster testing
/*
if (ApplicationLauncher.VerifyOnDeveloperMachine()) {
Thread.Sleep(6000);
} else {
Thread.Sleep(60000);
}
*/
return new GuiFileDialog(dlg, window, caption);
}
示例2: GetButton
public static GuiButton GetButton(AutomationElement window, string name)
{
AutomationElement res;
if (name == "Close")
res = window.FindChildByControlTypeAndAutomationIdAndName(ControlType.Button, "button", name);
else
res = window.FindChildByControlTypeAndName(ControlType.Button, name);
return new GuiButton(res, name);
}
示例3: GetTabByName
public static GuiTabItem GetTabByName(AutomationElement parentWindow, string name)
{
if (_cachedTab == null || _cachedTab.AutomationId != name) {
var res = parentWindow.FindChildByControlTypeAndName(ControlType.TabItem, name);
_cachedTab = new GuiTabItem(res, name);
_currentParentWindow = parentWindow;
}
return _cachedTab;
}
示例4: GetMenuItem
public static GuiMenuItem GetMenuItem(AutomationElement window, string name)
{
AutomationElement res;
if (name == "Close")
res = window.FindChildByControlTypeAndAutomationIdAndName(ControlType.MenuItem, "menuitem", name);
else
res = window.FindChildByControlTypeAndName(ControlType.MenuItem, name);
return new GuiMenuItem(res);
}
示例5: GetExpander
public static GuiExpander GetExpander(AutomationElement window, string name)
{
AutomationElement res = window.FindChildByControlTypeAndName(ControlType.Group, name);
return new GuiExpander(res, name);
}
示例6: GetRadioButton
public static GuiRadioButton GetRadioButton(AutomationElement window, string name)
{
AutomationElement res = window.FindChildByControlTypeAndName(ControlType.RadioButton, name);
return new GuiRadioButton(res);
}
示例7: GetTextBoxByName
public static GuiTextBox GetTextBoxByName(AutomationElement window, string name)
{
if (_cachedtb == null || _cachedtb.Name != name) {
var tb = window.FindChildByControlTypeAndName(ControlType.Edit, name);
_cachedtb = new GuiTextBox(tb);
}
return _cachedtb;
}