繁体   English   中英

如何使用Teststack.white自动化框架控制迷你窗口?

[英]How to get control on mini window using Teststack.white automation framework?

我正在使用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按钮。 单击后会打开一个新的迷你窗口。 我想控制该窗口,并想按其上的“确定”按钮。 谁能告诉我我该如何获得控制权?

开启迷你视窗后使用

var miniWindow = Application.GetWindow(SearchCriteria.ByText("miniWindowName"), InitializeOption.WithCache);
Button miniWindowButton = Window.Get<Button>("miniWindowButtonName");
miniWindowButton.Click();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM