0

i tried to setText"你好", but it didn't work, do you have any ideas about how to set chinese charactors?

        UiObject chatBox = mDevice.findObject(new UiSelector().resourceId("com.tencent.mm:id/z4"));
        if (chatBox.waitForExists(2000)==false) {
            assertFalse("cannot find chatBox option", false);
            return;
        } else {
            chatBox.click();
            chatBox.getSelector().focused(true);
            chatBox.setText("tell me a joke");
        }
Hainan
  • 1

1 Answers1

1

Either use the unicode escape sequences or save your java source files in UTF-8. In the former case, you need to look up the correct escape sequences, in the latter case, you can simply write the Chinese characters in src code. See here for examples UTF Encoding for Chinese CharactersJava If a UI element doesn't correctly display the characters, then the correct font might not be available or used.

Community
  • 1
  • 1
Guenther
  • 2,035
  • 2
  • 15
  • 20