Article source http://blog.csdn.net/meyoung01/article/details/43286265
Appium not support Chinese, waste a good big strength have not done. Finally with a soil approach to settle, directly see the package of code: [Java] View plain copy/*** Enter Chinese, and return * *@paramDriver Driver *@paramtext For example to enter "China" is the value of "Zhongguo" *@paramby locate the control you want to get text for *@return */ Public Staticstring SendText (androiddriver driver, string text, by) {string Returntext=NULL; Try{Thread.Sleep (2000); Process Pro= Runtime.getruntime (). EXEC ("cmd/c adb shell input text" +text); Thread.Sleep (1500); Runtime.getruntime (). EXEC ("cmd/c adb shell input keyevent keycode_space"); Thread.Sleep (2000); Returntext=driver.findelement (by). GetText (); } Catch(IOException e) {}Catch(interruptedexception e) {e.printstacktrace (); } returnReturntext; Note that when this method is called, the keyboard must be set to the default system keyboard, and the keyboard can be entered in Chinese. Accidental discovery has already supported the input of Chinese characters, as long as the following two items can be added in capabilities: Capabilities.setcapability ("Unicodekeyboard", "True"); Capabilities.setcapability ("Resetkeyboard", "True");
Note When this method is called, the keyboard must be set to the default system keyboard, and the keyboard can be entered in Chinese.
Accidental discovery has actually supported the input of Chinese characters,
Just add the following two settings to the capabilities:
Capabilities.setcapability ("Unicodekeyboard", "True");
Capabilities.setcapability ("Resetkeyboard", "True");
Appium solve Chinese input problems