加入:
desired_caps['unicodeKeyboard'] = True desired_caps['resetKeyboard'] = True
使用输入中文:android
input_txt = driver.find_element_by_id('cn.com.taodaji:id/search_edit') input_txt.send_keys(u'测试')
上述代码改变了手机默认输入法为 resetKeyboard , 这时再输入字符或数字时,会出现输入不彻底的问题,能够用如下方式切换输入法:shell
import os #列出系统如今所安装的全部输入法 -a cmd0 ='adb shell ime list -s' #打印系统当前默认的输入法 cmd1 ='adb shell settings get secure default_input_method' #切换输入法 cmd2 ='adb shell ime set com.sohu.inputmethod.sogouoem/.SogouIME' cmd3 ='adb shell ime set io.appium.android.ime/.UnicodeIME' def enable_sougou(): print (cmd2) os.system(cmd2) def enable_unicode(): os.system(cmd3)