Coded UI Test Builder fails to generate code for r

2020-07-22 16:21发布

问题:

I try to record the simplest Coded UI action in IE running on Windows 10 from my Visual Studio 2015 Enterprise. The problem is that recently I started to get Value cannot be null. Parameter name: key error each time I click Add and Generate button.

Also each time I hover the link on IE web page I get Access is denied error. I believe these problems could be related.

One more issue is that I can not generate any assertions since am unable to select any web control on web page. After I placed Coded UI Test Builder's crosshair in the middle of text input the whole document was highlighted.

To fix the issue I was advised to check project references. So I included any possibly related to Coded UI reference I could find. This is the full list of references included in the project:

Except that I've already tried to:
1. Restart VS
2. Restart PC
3. Run VS and IE as administrator (related to Access is Denied issue)
4. Added new UIMap file to the project. I tried to record actions there.
5. As it was suggested in one of the comments here I checked browser zoom level and set it to 100%.
6. Started new solution with new CodedUI test project.
7. Started Coded UI Test Builder from Visual Studio developer command prompt as a standalone application by executing codedUITestBuilder.exe /standalone in command line.
8. Tried to record Coded UI test against Windows Explorer. In result I've got a lot of // Access is denied. comment lines.
9. Started VS in a safe mode. Test builder does not fail but in result I get // The last action was not recorded because access to the application was denied. and no actual steps were recorded.
10. Ran Visual Studio as administrator in a safe mode so no external plugins are influencing VS.
11. I've reinstalled Visual Studio. It didn't help.
12. Enabled tracing for ui components but no actual output is generated during recording. The output window of Visual Studio under Testing tab remains empty.
13. Checked the CodedUITestBuilder.exe.config. The following configuration was commented so I uncommented it:

 <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>

14. As it is suggested in one the comments here I added %ProgramFiles%\Internet Explorer\iexplore.exe as one of the values of ExcludeProcess and then IncludeProcess sections in CodedUITestBuilder.exe.config. The thing is that now I actually do not see Access is Denied error, but still I'm not able to record any steps or move crosshair on html control.

Most of the solutions in the web are to reinstall Visual Studio and if it doesn't help - reinstall Windows. This is unacceptable solution for me. How can I solve the issue without reinstalling my Visual Studio and/or Windows?

回答1:

I tried all the items on your list and then the following got it to work:

(Right click):

"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CodedUITestBuilder.exe" 

(Check):

"Properties\Compatability\Change settings for all users\Run the program in compatability mode for:" 

(Select):

"Windows 7"

also maybe this:

(Check):

"Properties\Compatability\Change settings for all users\Run this program as an administrator"

I also disabled Malware Bytes but don't think this affected it. I'm not exactly sure whether it was a combination of these but it started working after "Windows 7 Compatability". These are more items you can add to your list at least.

Steve



回答2:

I had got the same error while trying to record and generate method. I was doing a set of actions including a calendar control date entry.

I did each step as a separate recorded method and I was able to figure the issue was with Calendar pop up. So completed the script with descriptive code on that and recorded the rest of the actions.

Please check if your application has a custom control which is causing this issue.