Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

UiAutomator input Chinese, super-detailed steps

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report