@@ -600,6 +600,50 @@ def set_network_connection(self, connectionType):
600600 }
601601 return self .execute (Command .SET_NETWORK_CONNECTION , data )['value' ]
602602
603+ @property
604+ def available_ime_engines (self ):
605+ """Get the available input methods for an Android device. Package and
606+ activity are returned (e.g., ['com.android.inputmethod.latin/.LatinIME'])
607+ Android only.
608+ """
609+ return self .execute (Command .GET_AVAILABLE_IME_ENGINES , {})['value' ]
610+
611+ def is_ime_active (self ):
612+ """Checks whether the device has IME service active. Returns True/False.
613+ Android only.
614+ """
615+ return self .execute (Command .IS_IME_ACTIVE , {})['value' ]
616+
617+ def activate_ime_engine (self , engine ):
618+ """Activates the given IME engine on the device.
619+ Android only.
620+
621+ :Args:
622+ - engine - the package and activity of the IME engine to activate (e.g.,
623+ 'com.android.inputmethod.latin/.LatinIME')
624+ """
625+ data = {
626+ 'engine' : engine
627+ }
628+ self .execute (Command .ACTIVATE_IME_ENGINE , data )
629+ return self
630+
631+ def deactivate_ime_engine (self ):
632+ """Deactivates the currently active IME engine on the device.
633+ Android only.
634+ """
635+ self .execute (Command .DEACTIVATE_IME_ENGINE , {})
636+ return self
637+
638+ @property
639+ def active_ime_engine (self ):
640+ """Returns the activity and package of the currently active IME engine (e.g.,
641+ 'com.android.inputmethod.latin/.LatinIME').
642+ Android only.
643+ """
644+ return self .execute (Command .GET_ACTIVE_IME_ENGINE , {})['value' ]
645+
646+
603647 def _addCommands (self ):
604648 self .command_executor ._commands [Command .CONTEXTS ] = \
605649 ('GET' , '/session/$sessionId/contexts' )
@@ -660,6 +704,16 @@ def _addCommands(self):
660704 ('GET' , '/session/$sessionId/network_connection' )
661705 self .command_executor ._commands [Command .SET_NETWORK_CONNECTION ] = \
662706 ('POST' , '/session/$sessionId/network_connection' )
707+ self .command_executor ._commands [Command .GET_AVAILABLE_IME_ENGINES ] = \
708+ ('GET' , '/session/$sessionId/ime/available_engines' )
709+ self .command_executor ._commands [Command .IS_IME_ACTIVE ] = \
710+ ('GET' , '/session/$sessionId/ime/activated' )
711+ self .command_executor ._commands [Command .ACTIVATE_IME_ENGINE ] = \
712+ ('POST' , '/session/$sessionId/ime/activate' )
713+ self .command_executor ._commands [Command .DEACTIVATE_IME_ENGINE ] = \
714+ ('POST' , '/session/$sessionId/ime/deactivate' )
715+ self .command_executor ._commands [Command .GET_ACTIVE_IME_ENGINE ] = \
716+ ('GET' , '/session/$sessionId/ime/active_engine' )
663717
664718
665719# monkeypatched method for WebElement
0 commit comments