本文介绍了CoddedUI抛出异常 - 无法找到底层进程的主窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好, 


我正在尝试使用以下代码启动Winform应用程序: 


1 -


  ProcessStartInfo p = new ProcessStartInfo(@"filepath\Domino.Winview.exe");

            p.WorkingDirectory = Path.GetDirectoryName(@"filepath\Domino.Winview.exe");

            Process AppProcess = Process.Start(p);

            ApplicationUnderTest appStartApplication = ApplicationUnderTest.FromProcess(AppProcess); 


2- 


ApplicationUnderTest calcApp = ApplicationUnderTest.Launch(@" filepath \ Domino.Winview.exe");


在两种情况下启动应用程序但抛出异常: 


无法找到基础流程的主窗口





Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException未被用户代码处理

  HResult = -268111872

 消息=无法找到基础流程的主窗口。

  Source = Microsoft.VisualStudio.TestTools.UITesting

  BasicMessage =无法找到基础流程的主窗口。

  StackTrace:

        at Microsoft.VisualStudio.TestTools.UITesting.ApplicationUnderTest.SetCurrentProcessPrivate(Process value)

  &NBSP; &NBSP;   at Microsoft.VisualStudio.TestTools.UITesting.ApplicationUnderTest。<> c__DisplayClassb。< set_Process> b__a()

  &NBSP; &NBSP;   at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod [T](Func`1 function,UITestControl control,Boolean firePlaybackErrorEvent,Boolean logAsAction)

  &NBSP; &NBSP;   at Microsoft.VisualStudio.TestTools.UITesting.ApplicationUnderTest.set_Process(Process value)

  &NBSP; &NBSP;   at Microsoft.VisualStudio.TestTools.UITesting.ApplicationUnderTest.FromProcess(Process processToWrap)

  &NBSP; &NBSP;  在C中的CodedUITestProject1.CodedUITest1.CodedUITestMethod1()中:\ Users \ k_agrawal \ Files \ Visual Studio 2013 \Projects \ CodedUITestProject1 \ CodedUITestProject1 \ CodedUITest1.cs:第37行¥b $ b  InnerException: 



解决方案

Hello, 

I am trying to launch a Winform application using below code: 

1-

 ProcessStartInfo p = new ProcessStartInfo(@"filepath\Domino.Winview.exe");
            p.WorkingDirectory = Path.GetDirectoryName(@"filepath\Domino.Winview.exe");
            Process AppProcess = Process.Start(p);
            ApplicationUnderTest appStartApplication = ApplicationUnderTest.FromProcess(AppProcess); 

2- 

ApplicationUnderTest calcApp = ApplicationUnderTest.Launch(@"filepath\Domino.Winview.exe");

in both the cases its launching the application but throwing below exception: 

Unable to find the main window of the underlying process


Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException was unhandled by user code
  HResult=-268111872
  Message=Unable to find the main window of the underlying process.
  Source=Microsoft.VisualStudio.TestTools.UITesting
  BasicMessage=Unable to find the main window of the underlying process.
  StackTrace:
       at Microsoft.VisualStudio.TestTools.UITesting.ApplicationUnderTest.SetCurrentProcessPrivate(Process value)
       at Microsoft.VisualStudio.TestTools.UITesting.ApplicationUnderTest.<>c__DisplayClassb.<set_Process>b__a()
       at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction)
       at Microsoft.VisualStudio.TestTools.UITesting.ApplicationUnderTest.set_Process(Process value)
       at Microsoft.VisualStudio.TestTools.UITesting.ApplicationUnderTest.FromProcess(Process processToWrap)
       at CodedUITestProject1.CodedUITest1.CodedUITestMethod1() in c:\Users\k_agrawal\Documents\Visual Studio 2013\Projects\CodedUITestProject1\CodedUITestProject1\CodedUITest1.cs:line 37
  InnerException: 


解决方案


这篇关于CoddedUI抛出异常 - 无法找到底层进程的主窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 07:04