我正在尝试使用 TestStack/White API(基于 Microsoft 的 UI 自动化库)自动化应用程序。
问题如下:
在自动化的某个点上,我必须处理一个“对话”窗口,如果我查看“Windows 任务管理器”,它看起来是一个单独的进程。但无论我如何尝试访问“对话窗口”(类、ID、文本、ControlType 等),我都无法访问它。
您可以在下面找到 UISpy 图像和代码...
using (var DISCLAIMER_App = Application.Attach(@"PathToExecutable"))
using (var DISCLAIMER_Window = DISCLAIMER_App.GetWindow(SearchCriteria.ByClassName("#32770"), InitializeOption.NoCache))
{
var IAccept_button = DISCLAIMER_Window.Get<Button>(SearchCriteria.ByText("I accept"));
IAccept_button.Click();
}
# I've tried also Application.Launch, Application.AttachOrLaunch.
# I also looked to be sure that the Dialog window is a separated process and doesn't belong to any parent window.
有什么建议么?