0
    public void RecordedMethod_Sample(int x)
    {
        #region Variable Declarations
        HtmlCell uISALESREVENUECell = this.UIDashboardWindowsInteWindow1.UIDashboardDocument.UITblWrapperOnlineStorTable.UISALESREVENUECell;
        HtmlImage uIImagegifbase64R0lGODImage = this.UIDashboardWindowsInteWindow1.UIDashboardDocument.UIImagegifbase64R0lGODImage;
        HtmlHyperlink uIPostPurchase4Hyperlink = this.UISalesRevenueandGrossWindow.UISalesRevenueandGrossDocument.UIPostPurchase4ReturnsCustom.UIPostPurchase4Hyperlink;
        HtmlDiv uISalesRevenueByDataSoPane = this.UISalesRevenueandGrossWindow.UISalesRevenueandGrossDocument.UISalesRevenueByDataSoPane;
        #endregion

        // Set flag to allow play back to continue if non-essential actions fail. (For example, if a mouse hover action fails.)
        Playback.PlaybackSettings.ContinueOnError = true;

        // Mouse hover 'SALES REVENUE' cell at (82, 27)
        Mouse.Hover(uISALESREVENUECell, new Point(82, 27));

        // Reset flag to ensure that play back stops if there is an error.
        Playback.PlaybackSettings.ContinueOnError = true;

        // Click 'image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAA...' image
        Mouse.Click(uIImagegifbase64R0lGODImage, new Point(139, 64));

        // Set flag to allow play back to continue if non-essential actions fail. (For example, if a mouse hover action fails.)
        Playback.PlaybackSettings.ContinueOnError = true;

        // Mouse hover 'Post Purchase4' link at (144, 19)
        Mouse.Hover(uIPostPurchase4Hyperlink, new Point(144, 19));

        // Reset flag to ensure that play back stops if there is an error.
        Playback.PlaybackSettings.ContinueOnError = true;

        // Move 'Sales Revenue By Data Source' pane
        Mouse.StartDragging(uISalesRevenueByDataSoPane, new Point(79, 15));
        Mouse.StopDragging(uISalesRevenueByDataSoPane, 224, -4);
        string title = uISalesRevenueByDataSoPane.InnerText.ToString();
        if (title == "Sales Revenue By Data Source")
        {

        }

同时执行 Mouse.Hover(uISALESREVENUECell, new Point(82, 27)); 它给出以下错误不支持指定的方法。每当我尝试将其作为测试用例执行时,在通过自定义代码执行时一切都按预期工作,它给出了上述错误,任何人都可以帮助我...提前感谢您的所有输入

4

2 回答 2

0

“自定义代码”是什么意思?如果这意味着自定义控件,则错误很可能是因为自定义控件尚未编写为支持编码 UI。对于要与编码 UI 一起使用的自定义控件,它必须支持 MSAA 或 UIA 接口,或者具有来自较新代理机制的支持。

有关更多详细信息,请尝试通过 Web 搜索 Coded UI、MSAA 和 UIA。也看看这个博客http://blogs.msdn.com/b/visualstudioalm/archive/2012/05/24/coded-ui-test-new-extensibility-qfe.aspx

于 2013-04-17T10:30:26.897 回答
0

我有这个确切的问题。

最好的办法是尽可能多地使用记录器,然后仅在需要动态执行时才将内容从 UI 映射中移开,并且仅用于那些位。

让录音机为您完成所有工作,您将在播放过程中获得更好的可靠性。

于 2014-06-17T13:11:39.840 回答