KeyBoard buttons

Aug 10, 2010 at 5:13 AM

Hi All,

I saw White supporting KeyBoard keystrokes. Can I get a sample code for window.Keyboard and window.KeyIn() ? I want to use this property and method as for example I want to automate the process of pressing CTRL+D. If I could get sample of these methods it would be of real help.

Aug 10, 2010 at 7:12 AM
Edited Aug 10, 2010 at 7:13 AM



Keyboard keyboard = Keyboard.Instance;


take care that you leaveKey in all cases (in tear down for example)


Aug 10, 2010 at 7:19 AM

Hi Throndorin,


I tried this:

Window window = PrimaryUIControls.GetMCPWindow(WinFormUtils.GetApplication(processName), windowProperty);




But it didn't work.

I'm able to run stuff where i need to press only one key like control or enter.

Aug 10, 2010 at 7:26 AM
Edited Aug 10, 2010 at 7:27 AM


can you have a look where the focus is?

maybe try to click on title bar of the window before sending key events.

If the focus is not on the application under test your short cut will send to nothing.


Aug 10, 2010 at 7:42 AM


The focus is on the application. I ran the enter key press event and it worked out successfully then I ran this method but it didn't give anything. Desirably it should pop up a new window. Do i need to instantiate a keyboard object.  

Aug 10, 2010 at 8:57 AM

do you use an x64 OS and are the tests builded for x64?

Aug 10, 2010 at 9:05 AM

Its a 32 bit OS...