08:解决中文输入问题

问题

使用Appium进行Android测试时,使用send_keys()发送中文,输入框没有输入任何文本

1. 解决办法

使用Appium键盘,appium执行时,会在Android手机安装一个特殊键盘(即Appium Android lnput Manager for Unicode)

在Appum config中增加下列代码:

 'unicodeKeyboard':True,
 'resetKeyboard':True

解释

  1. 使用unicode的编码方式发送字符
  2. Unicode键盘并非虚拟键盘,在界面上不会显示出来

2. 说明

    Android tests allow for Unicode input by installing and using a specialized keyboard 
    that allows the text to be passed as ASCII text between Appium and the application
    being tested.

    In order to utilize this functionality, set the unicodeKeyboard desired capability is 
    set to true. If the keyboard should be returned to its original state, the resetKeyboard 
    desired capability should also be set to true. Otherwise Appium’s Unicode keyboard will
    remain enabled on the device after the tests are completed.

    Then tests can pass Unicode text to editable fields using send_keys

本文作者原创,禁止转载。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 173,227评论 25 708
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,908评论 18 139
  • afinalAfinal是一个android的ioc,orm框架 https://github.com/yangf...
    passiontim阅读 15,513评论 2 45
  • 宝宝昨天看到包子铺,就不停地指向那里,要买着吃,我说回去吃饭,不让她看,她就用指甲揪我……后来给她吹肥皂泡,吹...
    jr812阅读 93评论 0 0
  • “跑步者最艰难的一步便是跨出家门的第一步。”——ROM CLARKE 今天上午9:00,Keep的跑步功能上线,同...
    那些光阴阅读 546评论 0 1