Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

UiAutomator input Chinese, super-detailed steps

Shulou Source: shulou.com Published: 2022-06-03 06:30:32 09月15日 Update

1. The reason why the setText of UiAutomator cannot be entered into Chinese.

UiObject.setText (string) cannot enter non-ASCII characters, such as Chinese.

Second, the principle of UiAutomator Unicode input assistant

Principle: convert the original characters into Unicode text, and then enter all kinds of text through intermediate conversion

Jutf7 input method: Chinese-> Unicode- > keycode- > convert to Chinese

III. Operation steps

1. Download UiAutomator Unicode input Assistant

Open https://github.com/sumio/uiautomator-unicode-input-helper and click [Download Zip]

After the download is completed, save it to any local directory, and then decompress it, as shown below:

2. Open Eclipse and import assistant

1) Click File- > import- > Android- > Existing Android Code Into Workspace- > Next- > Browser- > Select the helper path after decompression, as shown below.

2) after the import is completed, the project is shown as follows:

3. Compile and install apk to the phone in Eclipse

Connect the phone to the computer, right-click Utf7Ime Project-> run as- > Android Application

4. Set the default input method utf7 in the mobile phone.

Open the phone's settings-language and input method-default input method-Select UTF7

5. Start writing UiAutomator test cases

1) copy the com and jp folders under the path\ uiautomator-unicode-input-helper-master\ UiAutomatorInputSample\ src, and paste them into the src of the project to be tested by Eclipse.

2) after the copy is completed, three more files have been added to the src, as shown below

3) write test cases and use obj.setText (Utf7ImeHelper.e (string)) to input Chinese, as shown below

Tags: Input Chinese assistant character mobile phone input method project test step principle string file path selection original three reason folder text text Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Apple OPPO Reno Redmi Shulou Technology