【问题标题】:android uiautomator: UIObject.setText with japanese characters failsandroid uiautomator:带有日文字符的 UIObject.setText 失败
【发布时间】:2013-07-16 05:16:25
【问题描述】:

我正在使用 android Ui Automator 来测试我的应用程序。我的问题是 uiObject.setText 方法不接受日文字符。

有没有办法通过 ui automator 框架实现将日文字符设置为 android 小部件的目标?

谢谢,

斯蒂芬

【问题讨论】:

    标签: android testing functional-testing android-uiautomator


    【解决方案1】:

    我遇到了同样的问题,所以我写了an IME 将仅使用 ASCII 字符的编码文本转换为 Unicode 文本。

    您可以使用它在可编辑字段中设置日文字符:

    import jp.jun_nama.test.utf7ime.helper.Utf7ImeHelper;
    
    ....
    
    // gets UiObject which refers to editable text
    UiObject editText = ...; 
    // inputs German umlaut characters
    editText.setText(Utf7ImeHelper.e("Danke schön"));
    // OR
    // inputs Japanese characters
    editText.setText(Utf7ImeHelper.e("ありがとう"));
    ....
    

    详情请见README.md

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-10
      • 1970-01-01
      • 2016-08-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多