1

在我的窗口对话框的编码 UI 项目中,我似乎无法克服这个异常。我试过使用总是搜索和其他一些选项。我试图使用打开窗口对话框按钮的选项,但这似乎不起作用,因为我没有看到打开按钮只有“确定”和一些与我试图做的事情无关的按钮。

我看到我的一个窗口正在返回 5 个窗口,我正在尝试使用代码 Order Of overcation 但这似乎不起作用。

目前这是我最新的代码,它仍然无法正常工作,仍然给我同样的异常错误

   WinWindow myDialogBox = new WinWindow();
        myDialogBox.FilterProperties.Add(WinWindow.PropertyNames.OrderOfInvocation, "5");
        myDialogBox.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
        myDialogBox.SearchProperties[WinWindow.PropertyNames.ClassName] = "DirectUIHWND";
        myDialogBox.SearchProperties[WinWindow.PropertyNames.ControlId] = "0";

        myDialogBox.DrawHighlight();


        WinWindow MyOpbenButton = new WinWindow(myDialogBox);
     //   myDialogBox.SearchProperties.Add(WinWindow.PropertyNames.OrderOfInvocation, "0");
        MyOpbenButton.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
        MyOpbenButton.SearchProperties[WinWindow.PropertyNames.Name] = "&Open";
        MyOpbenButton.SearchProperties[WinWindow.PropertyNames.ClassName] = "Button";
        //MyOpbenButton.SearchProperties[WinWindow.PropertyNames.ControlId] = "0";
        MyOpbenButton.DrawHighlight();


        //Testing this window produces 5 window with the same name and 
        control ID.  

        WinWindow matchingWindows = new WinWindow(myDialogBox);

       matchingWindows.SearchProperties.Add("Name", "&Open");

      //  matchingWindows.SearchProperties.Add("ControlId", "0");
       matchingWindows.SearchProperties.Add("ClassName", "Button");



        UITestControlCollection windowsFound = matchingWindows.FindMatchingControls();




        WinPane MyOpbenPane = new WinPane(MyOpbenButton);
        MyOpbenPane.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
        //MyOpbenPane.SearchProperties[WinPane.PropertyNames.Name] = "Open";
        MyOpbenPane.SearchProperties[WinPane.PropertyNames.ClassName] = "Button";
        // var myDialog = sharedControls.UIWindowsInternetExploWindow.UIWindowsInternetExplo_Open_Save_Dialog_LinksPage.UIItemWindow;           
        MyOpbenPane.DrawHighlight();
        return MyOpbenPane;

这产生的错误消息如下:

另一个控件正在阻止该控件。请使被阻止的控件可见,然后重试该操作。其他详细信息: \r\nTechnologyName: 'MSAA'\r\nName: '&Open'\r\nClassName: 'Button'\r\nControlType: 'Window'\r\n

4

2 回答 2

0

我经常遇到这种情况。我有一个应用程序,其标签总是被报告为隐藏,即使它们清晰可见。到目前为止,对我来说效果很好的是使用keyboard.sendkeys 发送选择选项卡的击键。

于 2015-03-23T22:14:59.370 回答
0

我使用测试生成器来解决这个问题。

我发现正在使用类名 32770 捕获对话屏幕。我还发现我无法将浏览器窗口传递到另一个窗口,我使用测试生成器手动编码了剩余的屏幕。

这是下面的代码。

  WinWindow window = new WinWindow();
        window.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
        window.SearchConfigurations.Add(SearchConfiguration.VisibleOnly);
        window.SearchProperties[WinWindow.PropertyNames.ClassName] = "#32770";
        window.SearchProperties[WinWindow.PropertyNames.Name] = "Windows Internet Explorer";
        window.WindowTitles.Add("Windows Internet Explorer");

        //window.DrawHighlight();

        WinCustom myDialogBox = new WinCustom(window);
        myDialogBox.SearchConfigurations.Add(SearchConfiguration.VisibleOnly);
        myDialogBox.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
        myDialogBox.SearchProperties[WinCustom.PropertyNames.ControlType] = "Dialog";
        myDialogBox.SearchProperties[WinCustom.PropertyNames.Name] = "Windows Internet Explorer";
        myDialogBox.WindowTitles.Add("Windows Internet Explorer");
        //myDialogBox.DrawHighlight();

        WinWindow myDialogwindow = new WinWindow(window);
        myDialogwindow.SearchConfigurations.Add(SearchConfiguration.VisibleOnly);
        myDialogwindow.SearchConfigurations.Add(SearchConfiguration.AlwaysSearch);
        myDialogwindow.SearchProperties[WinWindow.PropertyNames.AccessibleName] = "Windows Internet Explorer";
        myDialogwindow.SearchProperties[WinWindow.PropertyNames.ClassName] = "DirectUIHWND";
        myDialogwindow.WindowTitles.Add("Windows Internet Explorer");

        return myDialogwindow;
于 2015-03-22T18:03:51.867 回答