send_hotkey

def send_hotkey(
self,
hotkey: str,
preaction: Literal["setfocus", "click"] = PreAction.SetFocus,
timeout: int = 30
) -> None

Send hotkey to target element.

Parameters:
hotkey [Required]: str
   Hotkey string represents one key or combined keys. For example, to represent the letter A, input string “A”. To represent the letters A, B, and C, input paremeter “ABC”. For special keys, please refer to hotkeys.
preaction: PreAction
   The action to be taken before sending hotkey.
   setfocus: default value, setting the target element to focused state before sending hotkey.
   click: click the target element before sending hotkey.
timeout: int
   Timeout for the operation, the unit is second, and the default value is 30 seconds.

Returns:
 None

Example:


from clicknium import clicknium as cc, locator, ui

#send Ctrl+a
ui(locator.chrome.bing.search_sb_form_q).send_hotkey('^a')

#send Shift+End
ui(locator.chrome.bing.search_sb_form_q).send_hotkey('+{END}')

#send Win+e, first press 'Win', then press 'E' and release, and finally release 'Win'
ui(locator.chrome.bing.search_sb_form_q).send_hotkey('{WIN DOWN}e{WIN UP}')
What are your feelings
Updated on 29 August 2023