我正在使用 Teststack.white 自动化框架来控制 WINDOWS 平台下外部应用程序中的 UI 元素。我通过使用这些命令控制了应用程序的主窗口
// source exe file path.
private const string ExeSourceFile = @"C:\program files\myapp.exe";
//Global Variable to for Application launch
private static TestStack.White.Application Application;
//Global variable to get the Main window of myapp
private static TestStack.White.UIItems.WindowItems.Window MainWindow;
//start process for the above exe file location
var psi = new ProcessStartInfo(ExeSourceFile);
// launch the process through white application
Application = TestStack.White.Application.AttachOrLaunch(psi);
//Get the window of myapp
MainWindow = Application.GetWindow(SearchCriteria.ByText("myapp"),
InitializeOption.NoCache);
//Click the Connect button in main window
TestStack.White.UIItems.Button ConnectButton =
MainWindow.Get<TestStack.White.UIItems.Button>(SearchCriteria.ByText("Connect"));
ConnectButton.Click();
MainWindow.WaitWhileBusy();
到目前为止,此代码打开应用程序并控制主窗口,然后单击 CONNECT 按钮。点击后会打开一个新的迷你窗口。我想控制那个窗口并想按它上面的 OK 按钮。谁能告诉我如何获得该控制权?