Windows UI应用程序自动化TestStack(白色)GetWindow无法正常工作并始终提供异常。
请告诉我我错过了什么。
.NET 4.5.2 TestS
tack.White 0.13.3
void Test()
{
Application calcApp = null;
Window calcWindow = null;
calcApp = Application.Launch("calc.exe");
var MainWindowTitle = "Calculator";
System.Threading.Thread.Sleep(40 * 1000);
// calcWindow = calcApp.GetWindow("Calculator", InitializeOption.NoCache); Not Working
calcWindow = Retry.For(() => calcApp.GetWindow(SearchCriteria.ByText(MainWindowTitle), InitializeOption.NoCache), TimeSpan.FromMinutes(2));
Console.WriteLine("End test");
}
异常::
消息=找不到具有SearchCriteria名称=计算器的窗口 进程8292,等待5000 ms后Source = TestStack.White StackTrace:at TestStack.White.Factory.ChildWindowFactory.WaitTillFound(Func
1 find, String message) in c:\TeamCity\buildAgent\work\89a20b30302799e\src\TestStack.White\Factory\ChildWindowFactory.cs:line 43 at TestStack.White.Factory.WindowFactory.CreateWindow(SearchCriteria searchCriteria, Process process, InitializeOption option, WindowSession windowSession) in c:\TeamCity\buildAgent\work\89a20b30302799e\src\TestStack.White\Factory\WindowFactory.cs:line 83 at TestStack.White.Application.GetWindow(SearchCriteria searchCriteria, InitializeOption initializeOption) in c:\TeamCity\buildAgent\work\89a20b30302799e\src\TestStack.White\Application.cs:line 205 at Calculator_Automation.Program.<>c__DisplayClass2_0.<StartCalcTest>b__0() in E:\YogeshWork\ProjectWork\Win App Automation\Calculator Automation\Calculator Automation\Program.cs:line 53 at TestStack.White.Utility.Retry.For[T](Func
1 getMethod,Predicate1 shouldRetry, TimeSpan retryFor, Nullable
1 retryInterval in in C:\ TeamCity的\ buildAgent \工作\ 89a20b30302799e的\ src \ TestStack.White \公用\ Retry.cs:行 138在TestStack.White.Utility.Retry.For [T](Func1 getMethod, TimeSpan retryFor, Nullable
1 retryInterval)中 C:\ TeamCity的\ buildAgent \工作\ 89a20b30302799e的\ src \ TestStack.White \公用\ Retry.cs:行 95
P.S。 对于Windows 10上的“Calculator”应用程序,White框架无法获得主窗口句柄。任何人都知道为什么这不起作用?