TypeKeys Method (JavaJFCTextField)

Class

JavaJFCTextField.

Action

Sends a set of keystrokes or mouse button presses to the window when used with the Classic Agent.

Sends a set of keystrokes to the window when used with the Open Agent.

Syntax

window.TypeKeys (sEvents [, nDelay, useClipboard])
Variable Description
sEvents The keystrokes to type or mouse buttons to press. Mouse buttons are supported on the Classic Agent only. To specify mouse buttons, use <Button1>, <Button2>, or <Button3> in the string. STRING.
nDelay Optional: The delay between keystrokes (in seconds and fractions of seconds). NUMBER.
useClipboard Optional: Whether Silk Test Classic uses the new Clipboard method to send text. By default, this is set to FALSE and the original method, which is faster, is used. If you want to send special characters, we recommend setting the parameter to TRUE to use the slower Clipboard method. BOOLEAN.

Notes

  • On Windows, TypeKeys first gives the window input focus before typing into it.
  • If you specify nDelay, that value overrides the value set with the OPT_KEYBOARD_DELAY option, which you set with SetOption.
  • See Key Names for a list of key names.
  • A key can be followed by a counter, which defines how often the keys should be typed. The counter can be combined with the delay.
  • During the delay time, the screen is locked and interaction with the mouse and keyboard is no longer possible.
  • When recording with the DOM extension, TypeKeys ("<Tab>") will not be captured. Since the script refers to object to type in directly, it is not necessary to record this manual Tab. You can manually enter a TypeKeys ("<Tab>") into your script if you want to; it will just not be recorded.
  • When specifying groups of keys, such as Ctrl+Shift, the Classic Agent only supports minus signs (-) as a delimiter between key names while the Open Agent supports plus and minus signs.
  • If the TypeKeys method does not work as expected, you can try the SetText method.

Example

//shift-right will be executed 6 times
TextEditor.Document.TypeKeys ("<Shift-Right 6>")
//Shift-Right will be executed 6 times with a delay of 3 seconds before each execution, and uses the Clipboard method
TextEditor.Document.TypeKeys ("<Shift-Right 6>", 3, TRUE)