SendKeys

You use the SendKeys keyword to trigger keyboard events.

Signature

The SendKeys keyword supports the following signature:

SendKeys(Keystroke)

Note the following about the SendKeys keyword signature:

  • You must use SendKeys only if the test case requires an action to be performed using the keyboard.

  • You must open SendKeys in Inetpub.

  • You must enable screenshot for test steps when using SendKeys for debugging.

  • Before performing a SendKeys action, the focus must be on the object.

  • Avoid using the keyboard (including SendKeys) during unit testing of the test cases.

  • During batch execution, the computer window in which execution occurs must be closed, to avoid sending false key input.

  • Special characters keys are supported, including combinations of the following:

    • Lowercase a to z.

    • Uppercase A to Z.

    • Numerals 1 to 9.

  • The following keyboard keys are supported:

    ADD; ALT; ARROW_UP; ARROW_DOWN; ARROW_LEFT; ARROW_RIGHT; BACK_SPACE; CANCEL; CLEAR; COMMAND; CONTROL; DELETE; DECIMAL; DIVIDE; DOWN; END; ENTER; EQUALS; ESCAPE; F1; F2; F3; F4; F5; F6; F7; F8; F9; F10; F11; F12; HELP; HOME; INSERT; MULTIPLY; NUMPAD0; NUMPAD1; NUMPAD2; NUMPAD3; NUMPAD4; NUMPAD5; NUMPAD6; NUMPAD7; NUMPAD8; NUMPAD9; PAGE_UP; PAGE_DOWN; SHIFT LEFT; SHIFT RIGHT; SPACE; SUBTRACT; TAB; UP; OPENING_BRACE; CLOSING_BRACE.

Desktop Examples

The following table describes how to use the SendKeys keyword to trigger keyboard events in desktop applications.

Target Object Inputs Closing Action Comments

CTRL+ALT+N

N/A

N/A

Selects all records.

CTRL+S

N/A

N/A

Saves.

CTRL+TAB

N/A

N/A

Tabs out.