我正在用TestStack White编写一个简单的安装脚本,这样我就可以学习这个框架(我没有在网上找到很多信息)。
我正在为这个小实验使用英雄联盟安装
填写表格并按下下一步按钮后,安装程序会打开一个窗口。
我想知道是否有办法获取窗口,即使我不是执行它的人。
这是我用来运行应用程序的代码,直到新窗口打开:
private void pressXButton(White.Core.UIItems.WindowItems.Window currentWindow, string buttonName)
{
var xButton = currentWindow.Get<White.Core.UIItems.Button>(White.Core.UIItems.Finders.SearchCriteria.ByText(buttonName));
xButton.Click();
currentWindow.WaitWhileBusy();
}
public void RunScript()
{
White.Core.Application application = White.Core.Application.Launch(filePath);
White.Core.UIItems.WindowItems.Window window = application.GetWindow(windowTitle);
window.WaitWhileBusy();
pressXButton(window, NEXT_BUTTON_TEXT);
var radioButtonAgree = window.Get<White.Core.UIItems.RadioButton>(White.Core.UIItems.Finders.SearchCriteria.ByText("I accept the terms in the License Agreement"));
radioButtonAgree.Select();
window.WaitWhileBusy();
pressXButton(window, NEXT_BUTTON_TEXT);
pressXButton(window, NEXT_BUTTON_TEXT);
pressXButton(window, NEXT_BUTTON_TEXT);
pressXButton(window, NEXT_BUTTON_TEXT);
pressXButton(window, NEXT_BUTTON_TEXT);
pressXButton(window, "Install");
//afther pressing the Install Button the program ask to install Microsoft Visual C++ 2005 Redistributable Package and here is where im stcuk
}
(对不起我的英语不好)