我有问题获得Visual Studio 2013的编码UI测试框架,以始终如一地找到HtmlDocument
。编码UI测试 - 一致发现HtmlDocument
我刚才刚刚遇到过这个问题,它之前的工作很棒。不幸的是,自从我创建这些测试以来,很多事情都发生了变化(包括我的Visual Studio和Internet Explorer版本等),因此很难确定是什么原因导致了这种情况。而且,它大约2/3的时间工作的事实使得更难以排除故障。
在我的测试中,我有一组不同的用户登录到测试站点并执行各种操作。为了做到这一点,我通过UI测试生成器捕获了在按住shift键的同时右键单击Internet Explorer按钮的操作,然后单击“以不同的用户运行”菜单选项。测试继续输入用户凭证并加载其主页。 (每个用户在我的机器上都有一个配置文件,并且他们都有Google作为他们的主页。)拨打NavigateTo()
上BrowserWindow
允许我加载该网站,测试正式从那里开始。
注:如果可以找到网页,有对付任何前述HtmlDocuments或BrowserWindows没有问题
当我尝试打电话NavigateTo()
,给我下面的错误挂断正在发生。
... threw exception.
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException:
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException:
The playback failed to find the control with the given search properties.
Additional Details:
TechnologyName: 'MSAA'
ControlType: 'Button'
Name: 'Internet Explorer'
---> System.Runtime.InteropServices.COMException:
Error HRESULT E_FAIL has been returned from a call to a COM component..
编辑:有时候,我得到这个错误,而不是:
...threw exception. Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException: Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException: Unable to find Windows Internet Explorer window with 'Google - Internet Explorer' in the title. ---> Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException: The playback failed to find the control with the given search properties. Additional Details:
TechnologyName: 'MSAA'
ControlType: 'Window'
Name: 'Google - Internet Explorer'
产品类别: 'IEFrame' ---> System.Runtime.InteropServices.COMException:错误HRESULT E_FAIL已从调用返回COM组件..
我已经在尝试BrowserWindow
各种WaitFor
来电,HtmlDocument
等
我试过包括一个try
/catch
区块,它会忘记HtmlDocument
,如果它失败并再次尝试(所以它研究HtmlDocument
)以防万一,但这也不起作用。
搜索大量的知识并没有帮助我弄清楚如何解决这个问题(使用BrowserWindows
和HtmlDocuments
我似乎只能找到处理查找特定控件的问题是如此微不足道的事情)。
有没有人对我有任何想法或建议我还可以尝试什么?
我想我需要提供有关我的开发环境的信息,对吧? - Windows 7 Professional SP1 - Visual Studio 2013 Update 2 - Internet Explorer 11.0.5 – JibbaJamba 2014-09-22 20:40:00