Esempio n. 1
0
 def send_keys(self, text):
     '''发送字符串,目前不支持中文
     '''
     from qt4a.androiddriver.util import KeyCode
     key_list = KeyCode.get_key_list(text)
     for key in key_list:
         self.send_key(key)
Esempio n. 2
0
 def send_key(self, keys):
     '''发送按键
     '''
     if isinstance(keys, str):
         for item in KeyCode.get_key_list(keys):
             self.send_key(item)
         return
     elif isinstance(keys, list):
         # 组合键
         keys = [str(item) for item in keys]
         keys = ','.join(keys)
         
     if self.adb.is_rooted():
         logger.debug('SendKey %s' % keys)
         return self._send_command('SendKey', Keys=keys)
     else:
         return 'true' in self.run_driver_cmd('sendKey', keys)
Esempio n. 3
0
    def send_key(self, keys):
        """发送按键
        """
        if isinstance(keys, str):
            for item in KeyCode.get_key_list(keys):
                self.send_key(item)
            return
        elif isinstance(keys, list):
            # 组合键
            keys = [str(item) for item in keys]
            keys = ",".join(keys)

        if self.adb.is_rooted():
            logger.debug("SendKey %s" % keys)
            return self._send_command("SendKey", Keys=keys)
        else:
            return "true" in self.run_driver_cmd("sendKey", keys)