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

Appium Python微信自动化测试
本文介绍如何使用Appium和Python进行微信自动化测试,重点在于配置信息中增加'unicodeKeyboard'字段,确保能够输入中文字符。通过示例代码展示了如何初始化WebDriver,定位元素并发送包含中文的内容。

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)

 

转载于:https://www.cnblogs.com/Sandy-1128/p/appium-python-sandy-0306-3.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值