Windowsの電卓を操作しようとしています。私のプログラムがインスタンスを見つけた場合 (それが検出した場合)、プロセスの startInfo を TestStack の UIAutomation 用のホワイト フレームワークに提供する必要があります。ただし、次の例外が引き続き発生します。
System.ArgumentException was unhandled
HResult=-0
Message=The path is not of a legal form.
Source=mscorlib
StackTrace:
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.GetFullPathInternal(String path)
at System.IO.FileInfo.Init(String fileName, Boolean checkHost)
at System.IO.FileInfo..ctor(String fileName)
at TestStack.White.Application.Launch(ProcessStartInfo processStartInfo) in c:\TeamCity\buildAgent\work\89a20b30302799e\src\TestStack.White\Application.cs:line 60
at TestStack.White.Application.AttachOrLaunch(ProcessStartInfo processStartInfo) in c:\TeamCity\buildAgent\work\89a20b30302799e\src\TestStack.White\Application.cs:line 144
at Test_with_GUI.Tests.UIAutomation.Test() in c:\Users\BLAH\Test with GUI\test with gui\Tests\UIAutomation.cs:line 24
at Test_with_GUI.MainWindow.testing_component7() in c:\Users\BLAH\Test with GUI\test with gui\MainWindow.xaml.cs:line 257
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException
次のfound[0].StartInfo
コード行から
Process[] found = Process.GetProcessesByName("calc");
if (found.Length > 0)
{
using (var app = TestStack.White.Application.AttachOrLaunch(found[0].StartInfo))
{
using (var win = app.GetWindow(SearchCriteria.ByText("Calculator"), InitializeOption.NoCache))
{
Manipulation();
}
}
}
電卓プロセスはすでに実行中です。(アクセサリ > 電卓)