簡體   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