【发布时间】:2016-09-22 15:41:47
【问题描述】:
我正在使用 White 框架在基于 Windows 桌面的应用程序中进行 UI 自动化。我无法找到访问子窗口的方法。 UIAVerify 将窗口的属性描述为:
以下是参考代码:
public class Program
{
Application app = Application.Launch("Path to my application");
public Program()
{
//Getting the main window
Window MainWindow = app.GetWindow("MainForm", InitializeOption.NoCache);
MainWindow.WaitWhileBusy();
**//Here I wanna get the child window so that I can access controls on that window. Below is the code for getting child windows controls**
//Getting to the Firm box
TextBox firm = Childwindow.Get<TextBox>(SearchCriteria.ByAutomationId("1313948"));
//setting value for firm
firm.SetValue("FIRM2");
//getting StaffID text box
TextBox StaffID = Childwindow.Get<TextBox>(SearchCriteria.ByAutomationId("723272"));
StaffID.SetValue("Staff");
Button Ok = Childwindow.Get <Button>(SearchCriteria.ByAutomationId("_okB[enter image description here][1]utton"));
Ok.Click();
}
【问题讨论】:
标签: c# windows ui-automation white-framework