Open smithj19 opened 4 years ago
One of the possible solutions to test a press of keys combinations (shortcut/hotkey) propose in that thread: https://github.com/SeleniumHQ/selenium-ide/issues/754#issuecomment-688308753
After spending a couple of days for research, I finally found the way to simulate Shortcuts in Selenium IDE through the execute script
command:
const el = document.querySelector('CSS_SELECTOR_GOES_HERE');
const eventShortcut = new KeyboardEvent('keydown', {
bubbles: true,
keyCode: 80,
ctrlKey: true,
});
el.dispatchEvent(event);
The trick here is that bubbles: true
is required param.
🚀 Feature Proposal
Allow for sending multiple key presses simultaneously as part of the same testing step. For example, sending CTRL+S to use a keyboard shortcut to Save.
Motivation
Allows for more complex keyboard input options and the use of application keyboard shortcuts.
Example
Sending CTRL+S (or any other keyboard shortcuts supported by the application. For example any of those listed here: https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/basics/keyboard-shortcuts) to activate application features and functionality.