locked
Coded UI tests throw an exception (UITestControlNotFoundException) RRS feed

  • Question

  • I have done a simple recording logging into a web application logging out and closing the browser. How ever the first step in the code:

                uIMicrosoftDynamicsCRMWindow.NavigateToUrl(new System.Uri(this.LoginParams.UIMicrosoftDynamicsCRMWindowUrl2));
    

    generates an exception, UITestControlNotFoundException. Any idea what this means and a good workaround? I am just trying to evaluate the CodedUI tests to see if they would be useful but I cannot get a simple web application to run. Ideas?

    Thank you.

    Kevin


    Kevin Burton

    Thursday, October 23, 2014 6:19 PM

Answers

  • Hi Kevin,

    Based on your description, no control appeared during debugging test and that exception was thrown. I doubt that you did not include ‘opening a browser’ action during recording actions and you did not open the browser before you debugged/run the test. If you don’t include ‘opening a browser’ action during recording actions, please make sure you open the browser first before running/debugging test.

    If whether opening the browser is recorded is not the issue, please make sure that you are using the supported IE browser. Please check this document: Supported Configurations and Platforms for Coded UI Tests and Action Recordings

    In order to check a control, you need open your application, go to the page where the control is on and then open Coded UI Test Builder to drag the crosshair on the control. You don’t need wait the control appear during debugging. Note that Coded UI Test Builder can’t be used during debugging/running tests.

    Since you are not familiar with coded UI test, I recommend reading this document: Walkthrough: Creating, Editing and Maintaining a Coded UI Test to know how to create and run a coded UI.

    Best regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Amanda Zhu Friday, November 7, 2014 6:46 AM
    • Marked as answer by Amanda Zhu Monday, November 10, 2014 6:57 AM
    Monday, November 3, 2014 5:48 AM

All replies

  • Hi Kevin,

    Your exception is UITestControlNotFound which means that an expected control is not found during playback. Please go to the test result (It is Test Explorer if you are using VS2012 or VS2013) and check what control in the code line was throwing such exception.

    In order to resolve your issue, please provide us detailed exception messages and playback log.

    And I suggest dragging the crosshair on the problematic control and check its properties’ values after test failed, then compare them with the recorded property value. Sometime a control can’t be found because its search property’s value changes during playback.

    Best regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, October 24, 2014 5:55 AM
  • A control never shows up to put a cross-hair on. I followed the test with a debugger and the line I posted earlier is where the exception is being thrown from.

    Kevin Burton

    Friday, October 24, 2014 1:07 PM
  • Hi Kevin,

    I doubt that probably the control which is having this exception is uIMicrosoftDynamicsCRMWindow.

    Please make sure that you opened the application under test and the MicrosoftDynamicsCRMWindow control is visible on the application UI before you run the coded UI test.

    If the application under test is really opened and the ‘MicrosoftDynamicsCRMWindow’ control is visible on the UI before your run test, please drag the crosshair on the MicrosoftDynamicsCRMWindow control to check whether some properties’s values are changed, which caused the current exception.

    Thanks,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, October 27, 2014 3:00 AM
  • I don't seem to have an option to put a cross-hair on any control. Here is what I am seeing in the debugger (VS):


    Kevin Burton

    Monday, October 27, 2014 1:01 PM
  • Hi Kevin,

    When you debug the test, you can’t use crosshair. Crosshair is on Coded UI Test Builder. Please don’t debug/run your test method, and then open Coded UI Test Builder, then drag the crosshair on the problematic control. After you drag the crosshair on the control, its properties and property values will show in Coded UI Test Builder.

    Please see the images in “To add UI a control to coded UI test” section in this document:

    How to: Add UI Controls and Validation Code Using the Coded UI Test Builder

    If the property values of the problematic control is not changed with the recorded ones, could you please provide us an example solution including your test project and the URL address so that we can further look at your issue?

    Best regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, October 28, 2014 2:14 AM
  • Sorry. I am new to developing a test. The steps I took were:

    • Create a new Code UI project in Visual Studio.
    • When I create the project I am prompted to either record or use an existing recording. I choose to record.
    • A small app window appears at the bottom right hand corner of my screen. I select the start recording button.
    • I bring up a browser to a URL that corresponds to my web application.
    • I enter credentials to login. Then logout.
    • On the small app window I select stop recording and then generate code.
    • From Visual Studio I choose to debug all tests.
    • I get the exception mentioned above. No control ever appeared that I would have a chance to select, see, or put a "crosshair" on.

    Thank you for you assistance in pointing out what I have done wrong.

    Kevin


    Kevin Burton

    Friday, October 31, 2014 1:03 PM
  • Hi Kevin,

    Based on your description, no control appeared during debugging test and that exception was thrown. I doubt that you did not include ‘opening a browser’ action during recording actions and you did not open the browser before you debugged/run the test. If you don’t include ‘opening a browser’ action during recording actions, please make sure you open the browser first before running/debugging test.

    If whether opening the browser is recorded is not the issue, please make sure that you are using the supported IE browser. Please check this document: Supported Configurations and Platforms for Coded UI Tests and Action Recordings

    In order to check a control, you need open your application, go to the page where the control is on and then open Coded UI Test Builder to drag the crosshair on the control. You don’t need wait the control appear during debugging. Note that Coded UI Test Builder can’t be used during debugging/running tests.

    Since you are not familiar with coded UI test, I recommend reading this document: Walkthrough: Creating, Editing and Maintaining a Coded UI Test to know how to create and run a coded UI.

    Best regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Amanda Zhu Friday, November 7, 2014 6:46 AM
    • Marked as answer by Amanda Zhu Monday, November 10, 2014 6:57 AM
    Monday, November 3, 2014 5:48 AM
  • Hi Kevin,

    Any update? Whether you can make a coded UI test successfully now?

    Thanks,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, November 6, 2014 1:38 AM