本文介绍了编码的UI测试点击右键菜单项在Windows 7上运行但在Windows10上失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用visual studio 2017 CUIT并尝试自动右键单击通知溢出区域中的应用程序图标。右键单击它会显示退出菜单项。然后应该点击这个项目,但不能抛出异常。
在Windows 7上同样正常工作。

I am using visual studio 2017 CUIT and trying to automate right click on my application icon present in the notification overflow area. With right click it shows exit menu item. It is then supposed to click on this item but fails throwing below exception. Whereas same works fine on windows 7.

异常

测试方法CodedUITestProject1.CodedUITest2.CodedUITestMethod1 thrrew exception:


Microsoft.VisualStudio.TestTools.UITest.Extension.FailedToPerformActionOnHiddenControlException:无法对隐藏控件执行"Click"。其他详细信息:


TechnologyName:  'MSAA'
$
AccessibleName:  '上下文'

ClassName:  '#32768'

ControlType:  '窗口'

  ---> System.Runtime.InteropServices.COMException:来自HRESULT的异常:0xF004F002

Test method CodedUITestProject1.CodedUITest2.CodedUITestMethod1 threw exception:
Microsoft.VisualStudio.TestTools.UITest.Extension.FailedToPerformActionOnHiddenControlException: Cannot perform 'Click' on the hidden control. Additional Details:
TechnologyName:  'MSAA'
AccessibleName:  'Context'
ClassName:  '#32768'
ControlType:  'Window'
 ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0xF004F002

代码段

public void RecordedMethod2()

    {

        #region变量声明

        WinButton uINotificationChevronButton = this.UIItemWindow.UINotificationChevronButton;

        WinButton uIItemButton = this.UIItemWindow1.UIOverflowNotificationToolBar.UIItemButton;

        WinWindow uIItemWindow2 = this.UIItemWindow2;

        #endregion
public void RecordedMethod2()
    {
        #region Variable Declarations
        WinButton uINotificationChevronButton = this.UIItemWindow.UINotificationChevronButton;
        WinButton uIItemButton = this.UIItemWindow1.UIOverflowNotificationToolBar.UIItemButton;
        WinWindow uIItemWindow2 = this.UIItemWindow2;
        #endregion

推荐答案


这篇关于编码的UI测试点击右键菜单项在Windows 7上运行但在Windows10上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 23:42