def set_text(
self,
text: str,
by: Union[Literal["default", "set-text", "sendkey-after-click", "sendkey-after-focus"], InputTextBy]= InputTextBy.Default,
overwrite: bool = True,
timeout: int = 30
) -> None
Set text for the target element, it can be used to input text to a system.
Parameters:
text[Requried]: str
Text to be input to target element.
by: str | InputTextBy
The method to perform the text input operation.
set-text
: call system method to set text to the target element. Some Windows application elements may not be supported.
sendkey-after-click
: simulate mouse click to activate the element, then send keys by simulating keyboard.
sendkey-after-focus
: set the target element to focused state, then sending keys by simulating keyboard.
default
: using different methods per target element type. set-text
for web element and sendkey-after-click
for desktop element.
overwrite: bool
Whether overwrite or append the text on the target element, default is True.
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
ui(locator.chrome.bing.search_sb_form_q).set_text("clicknium", overwrite = False)