Selenium WebDriver 4

Send keyboard shortcuts

Medium70 pts~25 min
  • Actions API
  • Keyboard
  • Modifier keys
Practice app · Board Planner

Hover menus, drag and drop, context menu, click-and-hold and keyboard shortcuts.

Test URL
/lab/selenium-send-keyboard-shortcuts

Your starter code already declares TEST_URL — never hardcode a host.

Objective

Type into the command bar and trigger the Ctrl+K shortcut with modifier keys.

Your task

  1. 1Click #shortcut-input and type “open board”.
  2. 2Press Ctrl+K with Actions: keyDown(CONTROL), sendKeys("k"), keyUp(CONTROL), perform().
  3. 3Assert #shortcut-result reads “Shortcut: Ctrl+K”.
  4. 4Assert #shortcut-input still contains “open board” (the shortcut must not insert a “k”).

Acceptance criteria

  • Modifier keys are pressed with keyDown/keyUp (or Keys.chord)
  • #shortcut-result shows “Shortcut: Ctrl+K”
  • #shortcut-input keeps “open board”
  • At least 2 assertions pass

Selenium WebDriver 4 · Selenium · Mouse & keyboard actions