我们在进行appium自动化测试的时候会把键盘隐藏起来,使用unicodeKeyboard的编码方式来发送字符串,但是有时候页面没有搜索或者发送按钮的时候,无法使用键盘,遇到这样的问题该怎么办呢?
#初始化的时候设置
'unicodeKeyboard':True, #使用unicodeKeyboard的编码方式来发送字符串
'resetKeyboard':True#将键盘给隐藏起来
command0 ='adb shell ime list -s'#列出手机所有的输入法
command1 ='adb shell ime set io.appium.android.ime/.UnicodeIME'#appium输入法
command2 ='adb shell ime set com.sohu.inputmethod.sogou/.SogouIME'#搜狗输入法
command3='adb shell ime set com.baidu.input/.ImeService'#百度输入法
os.system(command1)#使用appium键盘
os.system(command2)#使用搜狗输入法
注意:使用命令adb shell ime list -s可以列出你手机所有的输入法
然后需要使用键盘的时候调出键盘,然后再使用appium键盘就可以啦