Test.Runner.Key
W3C WebDriver special key constants for use with Browser.sendKeys.
-- Press Enter on an element:
Browser.sendKeys Key.enter element session
-- Type text then press Enter:
Browser.sendKeys ("hello" ++ Key.enter) element session
Modifier Keys
The modifier keys (shift, control, alt, meta) behave differently from
all other keys. They are "sticky" — when sent, they stay held down and apply to
all subsequent characters until released by sending null.
-- Type "HELlo" (shift held for first 3 chars, then released):
Browser.sendKeys (Key.shift ++ "hel" ++ Key.null ++ "lo") element session
All other keys (like enter, backspace, tab, etc.) fire as a normal
key press and release. They do not stay held down.
Shift key (U+E008). This is a modifier key — it stays held down until
released by null.
Control key (U+E009). This is a modifier key — it stays held down until
released by null.
Meta key, also known as Command on macOS (U+E03D). This is a modifier
key — it stays held down until released by null.
Null key (U+E000). Releases all held modifier keys (shift, control, etc).
Control Keys
Cancel key (U+E001).
Help key (U+E002).
Backspace key (U+E003).
Tab key (U+E004).
Clear key (U+E005).
Return key (U+E006).
Enter key (U+E007).
Pause key (U+E00B).
Escape key (U+E00C).
Space key (U+E00D).
Navigation Keys
Page Up key (U+E00E).
Page Down key (U+E00F).
End key (U+E010).
Home key (U+E011).
Left arrow key (U+E012).
Up arrow key (U+E013).
Right arrow key (U+E014).
Down arrow key (U+E015).
Insert key (U+E016).
Delete key (U+E017).
Numpad Keys
Numpad 0 key (U+E01A).
Numpad 1 key (U+E01B).
Numpad 2 key (U+E01C).
Numpad 3 key (U+E01D).
Numpad 4 key (U+E01E).
Numpad 5 key (U+E01F).
Numpad 6 key (U+E020).
Numpad 7 key (U+E021).
Numpad 8 key (U+E022).
Numpad 9 key (U+E023).
Numpad multiply key (U+E024).
Numpad add key (U+E025).
Numpad separator key (U+E026).
Numpad subtract key (U+E027).
Numpad decimal key (U+E028).
Numpad divide key (U+E029).
Function Keys
F1 key (U+E031).
F2 key (U+E032).
F3 key (U+E033).
F4 key (U+E034).
F5 key (U+E035).
F6 key (U+E036).
F7 key (U+E037).
F8 key (U+E038).
F9 key (U+E039).
F10 key (U+E03A).
F11 key (U+E03B).
F12 key (U+E03C).
Punctuation Keys
Semicolon key (U+E018).
Equals key (U+E019).