Uiautomator input Chinese, ultra-detailed steps

Source: Internet
Author: User


One, Uiautomator settext cannot enter the reason of Chinese

Uiobject.settext (String) cannot enter non-ASCII characters, such as Chinese.


Second, uiautomator Unicode input helper principle

Principle: Converts the input original character into Unicode text, and then enters various text through the intermediate conversion

Jutf7 Input Method: Chinese->unicode->keycode-> convert to Chinese


Third, the Operation procedure

1. Download Uiautomator Unicode input Assistant

Open Https://github.com/sumio/uiautomator-unicode-input-helper, point "Download Zip"

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/85/5B/wKioL1ehZk-ykFXOAACSgMG7tr0425.png "title=" Qq20160803113350.png "alt=" Wkiol1ehzk-ykfxoaacsgmg7tr0425.png "/>


After the download is complete, save to any local directory and unzip it, such as:

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/85/5C/wKiom1ehZt3SUSO5AAAxoZX30rI980.png "title=" Qq20160803113641.png "alt=" Wkiom1ehzt3suso5aaaxozx30ri980.png "/>


2. Open Eclipse, import assistant

1) Click File->import->android->existing Android Code into workspace->next->browser-> to select the assistant path after decompression, such as

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/85/5C/wKiom1ehZ8HASiDJAABT24YqaiI294.png "title=" Qq20160803113855.png "alt=" Wkiom1ehz8hasidjaabt24yqaii294.png "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/85/5B/wKioL1ehaHjSfC_aAABgrA8GoE4871.png "style=" float: none; "title=" Qq20160803114124.png "alt=" Wkiol1ehahjsfc_aaabgra8goe4871.png "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/85/5C/wKiom1ehaHijXfCnAACkkJC7c94322.png "style=" float: none; "title=" Qq20160803114255.png "alt=" Wkiom1ehahijxfcnaackkjc7c94322.png "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/85/5B/wKioL1ehaHjBnaYUAABjHWQySkY232.png "style=" float: none; "title=" Qq20160803114326.png "alt=" Wkiol1ehahjbnayuaabjhwqysky232.png "/>

2) After the import is completed, the project shows such as:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/85/5B/wKioL1ehaNXSsjA0AABPg2y63nI998.png "title=" Qq20160803114449.png "alt=" Wkiol1ehanxssja0aabpg2y63ni998.png "/>

3. Compile and install apk to phone in eclipse

Phone with computer, right click Utf7ime Project->run as->android Application

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/85/5C/wKiom1ehagfwK6IkAACsu6_PgMg720.png "title=" Qq20160803114932.png "alt=" Wkiom1ehagfwk6ikaacsu6_pgmg720.png "/>

4, set the default input method in the phone Utf7

Turn on phone settings-language and Input Method-default IME-select UTF7

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/85/5B/wKioL1eham7QEVRyAACJi-WObE8737.png "title=" Qq20160803115132.png "alt=" Wkiol1eham7qevryaacji-wobe8737.png "/>

5. Start writing uiautomator test Cases

1) Copy the COM and JP folders under path \uiautomator-unicode-input-helper-master\uiautomatorinputsample\src and paste them into the SRC of the project that eclipse is testing.

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/85/5B/wKioL1eha-KRcgUMAAAXd6k1__M252.png "title=" Qq20160803115809.png "alt=" Wkiol1eha-krcgumaaaxd6k1__m252.png "/>

2) After the copy is completed, SRC has three more files, such as

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/85/5B/wKioL1ehbI2gAW4HAAAWW3r7_QE238.png "title=" Qq20160803120018.png "alt=" Wkiol1ehbi2gaw4haaaww3r7_qe238.png "/>

3) Write the test case, using Obj.settext (UTF7IMEHELPER.E (String)), you can implement the input of Chinese, such as

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/85/5C/wKioL1ehbZGyHDrWAAA1bT-DqOk431.png "title=" Qq20160803120415.png "alt=" Wkiol1ehbzgyhdrwaaa1bt-dqok431.png "/>

Uiautomator input Chinese, ultra-detailed steps

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.