How to use _get_ime_list method in Airtest

Best Python code snippet using Airtest

ime.py

Source:ime.py Github

copy

Full Screen

...27 self.adb = adb28 self.apk_path = apk_path29 self.service_name = service_name30 self.started = False31 def _get_ime_list(self):32 """33 Return all the input methods on the device34 Returns:35 list of all input methods on the device36 """37 out = self.adb.shell("ime list -a")38 m = re.findall("mId=(.*?/.*?) ", out)39 return m40 def __enter__(self):41 self.start()42 def __exit__(self, exc_type, exc_val, exc_tb):43 self.end()44 def start(self):45 """46 Enable input method47 Returns:48 None49 """50 try:51 self.default_ime = self.adb.shell("settings get secure default_input_method").strip()52 except AdbError:53 # settings cmd not found for older phones, e.g. Xiaomi 2A54 # /system/bin/sh: settings: not found55 self.default_ime = None56 self.ime_list = self._get_ime_list()57 if self.service_name not in self.ime_list:58 if self.apk_path:59 self.device.install_app(self.apk_path)60 if self.default_ime != self.service_name:61 self.adb.shell("ime enable %s" % self.service_name)62 self.adb.shell("ime set %s" % self.service_name)63 self.started = True64 def end(self):65 """66 Disable input method67 Returns:68 None69 """70 if self.default_ime and self.default_ime != self.service_name:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Airtest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful