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.测试代码中加入

 self.driver = webdriver.Remote("http://127.0.0.1:4725/wd/hub", desired_caps2)

 element = self.driver.find_element_by_xpath(xxxxx)

 SendContent = "我爱中华"

 element.send_keys(u"%s" % SendContent)
上一篇:Go语言的优点(oschina讨论)


下一篇:GMF:如何在不打开Editor的情况下生成图片