SendKeys Method
Use the SendKeys method to send a key command to a control.
The Sendkeys method relies on native injection to work and this is not available when you use the Chrome Universal Web Adapter to interrogate the Chrome browser. You can, however, use this methods to interrogate controls on the webpage being displayed, just not Chrome browser controls, such as Refresh, Minimize, and Maximize.
See the Sample Automation for an example using the SendKeys method. This method has two parameters, as shown in this design block:
Use the Keys parameter to send key values or commands:
Send a keyboard value by typing the value. For example, send the text ATL to a control by typing ATL in the Keys parameter.
Send keyboard command by enclosing
the command in curly brackets. For example, send the Tab keyboard
command by typing {TAB} in the keys parameter. For more
information, see Keyboard Command List.
Note: The plus sign (+), caret (^), percent sign (%), tilde
(~), and parentheses () have special meanings to this method. To send
any of these as literal characters, enclose the character in braces.
For example, to send the plus sign, enter {+} for the command.
Enclose each bracket in braces {[}, even though the square brackets [ ] do not have a special meaning to the SendKeys method.
Specify keys combined with any combination of the Shift, Ctrl, and Alt keys by preceding the key code with one or more of the following codes.
Key |
Code |
Shift |
+ |
Ctrl |
^ |
Alt |
% |
Specify that any combination of Shift, Ctrl, and Alt should be held down while several other keys are pressed and enclose the code for those keys in parentheses. For example, to specify to hold down Shift while E and C are pressed, use +(EC). To specify to hold down Shift while E is pressed, followed by C without Shift, use +EC.
In the Text adapter, there are methods defined for specific keys to be pressed, such as F3 and Enter, or you can use SendKeys(WinHllapiKey key). The SendKeys(string keys) method does not support the {xxx} format. Send plain text with the SendKeys(string) method.
Specify repeating keys by using the form {key number}. You must put a space between key and number. For example, {LEFT 42} means press the left arrow key 42 times.
Use the Focus parameter to specify whether the control should receive focus when the key or command is sent. This parameter is usually set to True to focus the control.
Privacy | Trademarks | Terms of Use | Feedback
Updated: 18 June 2020
© 2016 - 2020 Pegasystems Inc. Cambridge, MA All rights reserved.