InputClientDispatchKeyEventAsync Method |
Version 130.1.90
Dispatches a key event to the page.
Namespace: CefSharp.DevTools.InputAssembly: CefSharp.Core (in CefSharp.Core.dll) Version: 129.0.110.0
Syntax public Task<DevToolsMethodResponse> DispatchKeyEventAsync(
DispatchKeyEventType type,
int? modifiers = null,
double? timestamp = null,
string text = null,
string unmodifiedText = null,
string keyIdentifier = null,
string code = null,
string key = null,
int? windowsVirtualKeyCode = null,
int? nativeVirtualKeyCode = null,
bool? autoRepeat = null,
bool? isKeypad = null,
bool? isSystemKey = null,
int? location = null,
string[] commands = null
)
public:
Task<DevToolsMethodResponse^>^ DispatchKeyEventAsync(
DispatchKeyEventType type,
Nullable<int> modifiers = nullptr,
Nullable<double> timestamp = nullptr,
String^ text = nullptr,
String^ unmodifiedText = nullptr,
String^ keyIdentifier = nullptr,
String^ code = nullptr,
String^ key = nullptr,
Nullable<int> windowsVirtualKeyCode = nullptr,
Nullable<int> nativeVirtualKeyCode = nullptr,
Nullable<bool> autoRepeat = nullptr,
Nullable<bool> isKeypad = nullptr,
Nullable<bool> isSystemKey = nullptr,
Nullable<int> location = nullptr,
array<String^>^ commands = nullptr
)
Parameters
- type DispatchKeyEventType
- Type of the key event.
- modifiers NullableInt32 (Optional)
- Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8(default: 0).
- timestamp NullableDouble (Optional)
- Time at which the event occurred.
- text String (Optional)
- Text as generated by processing a virtual key code with a keyboard layout. Not needed forfor `keyUp` and `rawKeyDown` events (default: "")
- unmodifiedText String (Optional)
- Text that would have been generated by the keyboard if no modifiers were pressed (except forshift). Useful for shortcut (accelerator) key handling (default: "").
- keyIdentifier String (Optional)
- Unique key identifier (e.g., 'U+0041') (default: "").
- code String (Optional)
- Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: "").
- key String (Optional)
- Unique DOM defined string value describing the meaning of the key in the context of activemodifiers, keyboard layout, etc (e.g., 'AltGr') (default: "").
- windowsVirtualKeyCode NullableInt32 (Optional)
- Windows virtual key code (default: 0).
- nativeVirtualKeyCode NullableInt32 (Optional)
- Native virtual key code (default: 0).
- autoRepeat NullableBoolean (Optional)
- Whether the event was generated from auto repeat (default: false).
- isKeypad NullableBoolean (Optional)
- Whether the event was generated from the keypad (default: false).
- isSystemKey NullableBoolean (Optional)
- Whether the event was a system key event (default: false).
- location NullableInt32 (Optional)
- Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default:0).
- commands String (Optional)
- Editing commands to send with the key event (e.g., 'selectAll') (default: []).These are related to but not equal the command names used in `document.execCommand` and NSStandardKeyBindingResponding.See https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/editing/commands/editor_command_names.h for valid command names.
Return Value
TaskDevToolsMethodResponsereturns System.Threading.Tasks.Task<DevToolsMethodResponse>
See Also