ExpandCollapse Pattern throwing bogus exception RRS feed

  • Question

  • I recently upgraded to VS2013 Update 3 from VS2012.  I now have about 200 tests that are failing due to a bogus exception being thrown by the expand/collapse pattern.

    System.Windows.Automation.ElementNotAvailableException: Element not available ---> System.InvalidOperationException: Operation is not valid due to the current state of the object.
       at UIAutomationClient.IUIAutomationExpandCollapsePattern.Collapse()

    The action being performed is to click on a point on the UI, not on a control.  The point is in the name of the tree item.  Why?  Because this is what a USER is going to do.

    First the control is available and I can perform other operations on it.

    Second, when the same actions are performed outside of codedui, the application behaves correctly.

    The second point is my real issue.  CodedUI should NEVER behave differently than the real application.  Otherwise it is useless because I cannot test real-life scenarios and I might as well go back to QTP.

    Tuesday, August 26, 2014 12:39 PM


  • Hi SGAnderson,

    Thank you for posting in the MSDN forum.

    To really understanding this issue, would you mind letting us know more information about this issue?

    1. Whether your VS2013 version support the Coded UI test? Genially we use Visual Studio Ultimate, Visual Studio Premium.
    2. Do you install two VS versions in the same machine? Please install VS2012 update 4 for your VS2012, and then re-compile and run your test project in VS2012, and then run it in VS2013 again.
    3. Whether all your 200 tests have the specific order requirements? For example, if one test failed, other test would be failed since they depend on the first tests. So we need to check the first test.
    4. Whether your tests have specific configurations like the test settings file? For example, they need to refer to specific deployment file, so we would check whether we set the correct path for the references in the test settings file.
    5. If you create a simple coded UI test, and then update it to VS2013, clean and rebuild your test project, test it. If it works well, I’m afraid that it would be the previous test projects’ issues.
    6. I know that there are 200 tests in your project, to check the real updated issue, we often use the VS2013 to record a new test, generate it to code, and then compare it with the previous test, we don’t have to re-record all tests, but we could test it for a specific test.

    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. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    Thursday, August 28, 2014 11:57 AM