Key Codes for Coded UI Tests

A colleague of mine asked me this week how he can emulate special keys in Coded UI Tests. I knew that I wrote that in my book but actually did not find the official reference in the MSDN. That’s why I will provide it here again. The Keyboard class provides different methods with which you can send texts or key codes to the UI element currently selected. Some of these methods also allow the use of modifier keys like Ctrl or Alt. All special keys are shown in the following list. They are usually surrounded by curly braces and can be part of any string (see also the example above). Key Code Backspace {BACKSPACE}, {BS} or {BKSP} Pause {BREAK} Capslock {CAPSLOCK} Delete {DELETE} or {DEL} End {END} Return {ENTER} or ~ Esc {ESC} Help {HELP} Pos1 {HOME} Insert {INSERT} or

Weiterlesen »