SendKeys
The SendKeys
method allows the user to send keystrokes and combinations to a Control or Page Object.
Sending special keys
You can send some special keys to controls using the Keys
class.
The Keys
class contains the following special keys categories:
Function Keys.
Navigation Keys.
System Keys.
Numeric Keys
Editing keys.
Lock keys.
Modifier Keys
The following is an example of the use of the Keys
class:
Key Combinations
The SendKeys method can be used to simulate hotkeys and accelerator keys on a control.
How to use
You have to enclose them in brackets ([])
, one or more modifier keys such as ctrl
, alt
or shift
with at least one character or special key. For example:
To escape braces and brackets, you need to write them twice, for example:
"[["
.Any key or special key enclosed on the brackets will have the specified modifiers active.
SendKeys vs. Text
Last updated
Was this helpful?