Appium发送中文或其他语言的问题

1. 需要在配置信息中增加'unicodeKeyboard' = “True”字段,如下:

def driver_weixin(platformVersion="6.0.1",deviceName='Galaxy A8'):
    desired_caps2 = {}
    desired_caps2['platformName'] = "Android"
    desired_caps2['platformVersion'] = platformVersion
    desired_caps2['deviceName'] = deviceName
    desired_caps2['udid'] = "75a2daf1"  
    #desired_caps2['automationName'] = 'UiAutomator2'
    desired_caps2['appPackage'] = 'com.tencent.mm'
    desired_caps2['appActivity'] = 'com.tencent.mm.ui.LauncherUI'
    desired_caps2['resetKeyboard'] = "True"   #隐藏键盘
    desired_caps2['unicodeKeyboard'] = "True"  
    return  desired_caps2

 

2.测试代码中加入

1 self.driver = webdriver.Remote("http://127.0.0.1:4725/wd/hub", desired_caps2)
2 
3 element = self.driver.find_element_by_xpath(xxxxx)
4 
5 SendContent = "我爱中华"
6 
7 element.send_keys(u"%s" % SendContent)

 

posted @ 2019-03-06 18:22  Sandy1128  阅读(199)  评论(0编辑  收藏  举报