MCPcopy Create free account
hub / github.com/ChromeDevTools/devtools-frontend / dispatchKeyDownEvent

Function dispatchKeyDownEvent

front_end/testing/DOMHelpers.ts:175–179  ·  view source on GitHub ↗
(element: T, options: KeyboardEventInit = {})

Source from the content-addressed store, hash-verified

173 * Dispatches a keydown event. Errors if the event was not dispatched successfully.
174 */
175export function dispatchKeyDownEvent<T extends Element>(element: T, options: KeyboardEventInit = {}) {
176 const clickEvent = new KeyboardEvent('keydown', options);
177 const success = element.dispatchEvent(clickEvent);
178 assert.isOk(success, 'Failed to trigger keydown event successfully.');
179}
180
181export function dispatchInputEvent<T extends Element>(element: T, options: InputEventInit = {}) {
182 const inputEvent = new InputEvent('input', options);

Calls 1

dispatchEventMethod · 0.80

Tested by 2

testClickFunction · 0.68
dispatchKeyDownFunction · 0.68