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 : String

Shift key (U+E008). This is a modifier key — it stays held down until released by null.

control : String

Control key (U+E009). This is a modifier key — it stays held down until released by null.

alt : String

Alt key (U+E00A). This is a modifier key — it stays held down until released by null.

meta : String

Meta key, also known as Command on macOS (U+E03D). This is a modifier key — it stays held down until released by null.

null : String

Null key (U+E000). Releases all held modifier keys (shift, control, etc).

Control Keys

cancel : String

Cancel key (U+E001).

help : String

Help key (U+E002).

backspace : String

Backspace key (U+E003).

tab : String

Tab key (U+E004).

clear : String

Clear key (U+E005).

return_ : String

Return key (U+E006).

enter : String

Enter key (U+E007).

pause : String

Pause key (U+E00B).

escape : String

Escape key (U+E00C).

space : String

Space key (U+E00D).

Navigation Keys

pageUp : String

Page Up key (U+E00E).

pageDown : String

Page Down key (U+E00F).

end : String

End key (U+E010).

home : String

Home key (U+E011).

arrowLeft : String

Left arrow key (U+E012).

arrowUp : String

Up arrow key (U+E013).

arrowRight : String

Right arrow key (U+E014).

arrowDown : String

Down arrow key (U+E015).

insert : String

Insert key (U+E016).

delete : String

Delete key (U+E017).

Numpad Keys

numpad0 : String

Numpad 0 key (U+E01A).

numpad1 : String

Numpad 1 key (U+E01B).

numpad2 : String

Numpad 2 key (U+E01C).

numpad3 : String

Numpad 3 key (U+E01D).

numpad4 : String

Numpad 4 key (U+E01E).

numpad5 : String

Numpad 5 key (U+E01F).

numpad6 : String

Numpad 6 key (U+E020).

numpad7 : String

Numpad 7 key (U+E021).

numpad8 : String

Numpad 8 key (U+E022).

numpad9 : String

Numpad 9 key (U+E023).

multiply : String

Numpad multiply key (U+E024).

add : String

Numpad add key (U+E025).

separator : String

Numpad separator key (U+E026).

subtract : String

Numpad subtract key (U+E027).

decimal : String

Numpad decimal key (U+E028).

divide : String

Numpad divide key (U+E029).

Function Keys

f1 : String

F1 key (U+E031).

f2 : String

F2 key (U+E032).

f3 : String

F3 key (U+E033).

f4 : String

F4 key (U+E034).

f5 : String

F5 key (U+E035).

f6 : String

F6 key (U+E036).

f7 : String

F7 key (U+E037).

f8 : String

F8 key (U+E038).

f9 : String

F9 key (U+E039).

f10 : String

F10 key (U+E03A).

f11 : String

F11 key (U+E03B).

f12 : String

F12 key (U+E03C).

Punctuation Keys

semicolon : String

Semicolon key (U+E018).

equals : String

Equals key (U+E019).