Coded UI Test Replay Error

时间:2016-07-11 21:25:15

标签: visual-studio-2015 coded-ui-tests

When I try to run a simple coded UI test that I have written it is failing when I try to run the test. It fails on the first Mouse.Click statement (line 12 below).

In english the steps are as follows:

  1. Launch a new Internet Explorer Window (I find it odd that it's listed as "Click 'Chrome Legacy Window client').
  2. Go to the Contact Page (localhost:6983/Contact).
  3. Type "ardvark" into a text box and click the submit button.
  4. When the button is click copy "ardvark" to a label.

At this point I'm just expecting the test method to replay those steps.

Here is the generated code:

 public void RecordedMethod1()
    {
        #region Variable Declarations
        WinClient uIChromeLegacyWindowClient = this.UIVisualstudio2015CodeWindow.UIChromeLegacyWindowWindow.UIChromeLegacyWindowClient;
        HtmlCustom uIBgexitCustom = this.UIMSNCanadaHotmailOutlWindow.UIMSNCanadaHotmailOutlDocument.UIADFrame.UIAolAdvertisementDocument.UIVarinDapIFtrueinFIFtPane.UIItemFrame.UIHttpnym1ibadnxscomifDocument.UIItemFrame.UIHttpanimpbidaceadverDocument.UIItem200_141_express_Frame.UIHttps02mdnnet2467206Document.UIBgexitCustom;
        BrowserWindow uIMSNCanadaHotmailOutlWindow = this.UIMSNCanadaHotmailOutlWindow;
        HtmlEdit uIText1Edit = this.UIMSNCanadaHotmailOutlWindow.UIContactMyASPNETAppliDocument.UIText1Edit;
        HtmlInputButton uIClickMeButton = this.UIMSNCanadaHotmailOutlWindow.UIContactMyASPNETAppliDocument.UIClickMeButton;
        #endregion

        // Click 'Chrome Legacy Window' client
        Mouse.Click(uIChromeLegacyWindowClient, new Point(565, 497));

        // 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 'bg-exit' custom control at (1, 1)
        Mouse.Hover(uIBgexitCustom, new Point(1, 1));

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

        // Go to web page 'http://localhost:6983/Contact'
        uIMSNCanadaHotmailOutlWindow.NavigateToUrl(new System.Uri(this.RecordedMethod1Params.UIMSNCanadaHotmailOutlWindowUrl));

        // Type 'ardvark' in 'text1' text box
        uIText1Edit.Text = this.RecordedMethod1Params.UIText1EditText;

        // Click 'Click Me' button
        Mouse.Click(uIClickMeButton, new Point(43, 17));
    }

The following is the error I'm getting: The following is the error I'm getting: {"The playback failed to find the control with the given search properties. Additional Details: \r\nTechnologyName: 'MSAA'\r\nControlType: 'Client'\r\nName: 'Chrome Legacy Window'\r\n"}

1 个答案:

答案 0 :(得分:0)

给鼠标点击应该是最后一个选项。积分不稳定。尝试捕获元素,然后执行鼠标单击。或者在代码中动态编写搜索属性,然后执行单击操作。