Ejemplo n.º 1
0
    def press_key(self, key, system_key=False):
        """Press key (keys should be configured inside emulator).

        :param key: key name.
        :param system_key: is emulator's system key or not.
        """
        handle = self.key_handle if not system_key else self.main_key_handle
        autoit.control_send_by_handle(self.main_key_handle, handle, key)
Ejemplo n.º 2
0
 def close_current_app(self):
     """Closes current opened app in emulator."""
     hwnd = self.key_handle if self.key_handle else self.main_key_handle
     try:
         autoit.control_send_by_handle(hwnd, hwnd,
                                       f"^{self.close_app_shortcut}")
     except autoit.AutoItError as err:
         logging.error(f"Error during sending to control {hwnd}:\n{err}")
         self.update_handlers()
         hwnd = self.key_handle if self.key_handle else self.main_key_handle
         logging.warning(f"Updating window's info, new control is {hwnd}")
         autoit.control_send_by_handle(hwnd, hwnd,
                                       f"^{self.close_app_shortcut}")
Ejemplo n.º 3
0
 def close_current_app(self):
     """Close current opened app in emulator."""
     hwnd = self.key_handle if self.key_handle else self.main_key_handle
     autoit.control_send_by_handle(hwnd, hwnd, f"^{self.close_app_shortcut}")