Python Selenium Common Keyboard Controls

Keyboard events
The previous send_keys() method is used to simulate keyboard input; the keys() class provides methods for almost all keys on the keyboard, and key combinations are also possible.

Commonly used keyboard operations are as follows.

send_keys(Keys.BACK_SPACE) Delete key (BackSpace)
send_keys(Keys.SPACE) Space key (Space)
send_keys(Keys.TAB) Tabulation key (Tab)
send_keys(Keys.ESCAPE) Return key (Esc)
send_keys(Keys.ENTER) Enter key (Enter)
send_keys(Keys.CONTROL,’a’) Select All (Ctrl+A)
send_keys(Keys.CONTTROL,’c’) Copy (Ctrl+C)
send_keys(Keys.CONTTROL,’x’) Cut (Ctrl+X)
send_keys(Keys.CONTTROL,’v’) Paste (Ctrl+V)
send_keys(Keys.F1) Keyboard F1
send_keys(Keys.F12) Keyboard F12

Keys.BACK_SPACE: Back Space key (BackSpace)
Keys.TAB: Tab key (Tab)
Keys.ENTER: Enter key (Enter)
SHIFT: Case conversion key (Shift)
Keys.CONTROL: Control key (Ctrl)
Keys.ALT: ALT key (Alt)
Keys.ESCAPE: Return key (Esc)
Keys.SPACE: Space bar (Space)
Keys.PAGE_UP: Page up key (Page Up)
PAGE_DOWN: page down key (Page Down)
Keys.END: End of line key (End)
LEFT: left arrow key (Left)
Keys.UP: Arrow keys up (Up)
Keys.RIGHT: arrow key right (Right)
DOWN: Down arrow key (Down)
INSERT: Insert key (Insert)
DELETE: Delete key (Delete)
NUMPAD0 ~ NUMPAD9: numeric keys 1-9
F1 ~ F12: F1 – F12 keys
(Keys.CONTROL, ‘a’): key combination Control+a, select all
(Keys.CONTROL, ‘c’): key combination Control+c, copy
(Keys.CONTROL, ‘x’): key combination Control+x, cut
(Keys.CONTROL, ‘v’): key combination Control+v, Paste

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *