CoddedUI抛出异常 - 无法找到底层进程的主窗口 [英] CoddedUI throwing Exception - Unable to find the main window of the underlying process

查看:75
本文介绍了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: 



解决方案

您好Kapil_dell,


欢迎来到MSDN论坛。


经过实验,他们可以在我这边正常工作。我的运行环境:VS2017 enterprise,win10。


您可以使用process.start(路径)和ApplicationUnderTest.Launch(Path)来尝试启动应用程序。而且他们两个也可以成功地在我身边。



如果问题仍然存在,您是否可以分享有关该项目的更多详细信息,或者我希望您可以使用github或一个驱动器共享示例,然后我将下载并测试我的。$


期待您的回复。


最好的问候,


迪伦


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: 


解决方案

Hi Kapil_dell,

Welcome to MSDN forum.

After experiment, they could work normally in my side. My running environment: VS2017 enterprise, win10.

May you could use process.start(path) and ApplicationUnderTest.Launch(Path) to try to launch the application. And both of them also can work successfully in my side.

If the issue persists, could you share more details about the project, or I would appreciate that you could share a sample using github or one drive, then I will download and test in my side.

Look forward to your reply.

Best Regards,

Dylan


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆