In my initial days, I have struggled lot to simulate keyboard inputs. To simulate keyboard inputs in CodedUI as easy as Selenium but sometime it’s hard to find CodedUI solution over the Google. With this post I am trying to break that hardness. So here we go…

if you wanted to send single key…



Keyboard.SendKeys(“{T}”); etc.

If you wanted to send combination keys like ALT+F4.


Code     Key

%          ALT

+           SHIFT

^           CTRL

If you wanted to press particular key 10 times, use below syntax-

//Below syntax will press LEFT ARROW key 10 times.

Keyboard.SendKeys(“{LEFT 10}”);

For more details you can go through this link


One thought on “How to simulate keyboard input in C# (CodedUI)

  1. Hi,

    I need to select multiple values from a List Box.
    So, need to hold down the Ctrl button on keyboard, until all the values are selected and then click on OK Button.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s