1313from pydantic import BaseModel
1414
1515from uiautodev .command_types import AppLaunchRequest , AppTerminateRequest , By , Command , CurrentAppResponse , \
16- DumpResponse , FindElementRequest , FindElementResponse , InstallAppRequest , InstallAppResponse , TapRequest , \
16+ DumpResponse , FindElementRequest , FindElementResponse , InstallAppRequest , InstallAppResponse , SendKeysRequest , TapRequest , \
1717 WindowSizeResponse
1818from uiautodev .driver .base_driver import BaseDriver
1919from uiautodev .exceptions import ElementNotFoundError
@@ -39,7 +39,7 @@ def get_command_params_type(command: Command) -> Optional[BaseModel]:
3939 return type_hints .get ("params" )
4040
4141
42- def send_command (driver : BaseDriver , command : Union [ str , Command ] , params = None ):
42+ def send_command (driver : BaseDriver , command : Command , params = None ):
4343 if command not in COMMANDS :
4444 raise NotImplementedError (f"command { command } not implemented" )
4545 func = COMMANDS [command ]
@@ -142,6 +142,14 @@ def dump(driver: BaseDriver) -> DumpResponse:
142142def wake_up (driver : BaseDriver ):
143143 driver .wake_up ()
144144
145+ @register (Command .SEND_KEYS )
146+ def send_keys (driver : BaseDriver , params : SendKeysRequest ):
147+ driver .send_keys (params .text )
148+
149+ @register (Command .CLEAR_TEXT )
150+ def clear_text (driver : BaseDriver ):
151+ driver .clear_text ()
152+
145153
146154def node_match (node : Node , by : By , value : str ) -> bool :
147155 if by == By .ID :
0 commit comments