uiautomator输入中文实例
package com.demo3;
import jp.jun_nama.test.utf7ime.helper.Utf7ImeHelper;
import com.android.uiautomator.core.UiDevice;
import com.android.uiautomator.core.UiObject;
import com.android.uiautomator.core.UiObjectNotFoundException;
import com.android.uiautomator.core.UiSelector;
import com.android.uiautomator.testrunner.UiAutomatorTestCase;
import com.demo3.UiAutomatorHelper;
public class Demo3 extends UiAutomatorTestCase {
public static void main(String[] args) {
new UiAutomatorHelper("demo","com.demo3.Demo3","testPress","7");
}
public void testPress() throws UiObjectNotFoundException{
UiSelector select=new UiSelector().resourceId("com.xgh.sport:id/search_tv");
// com.xgh.sport:id/search_tv
UiObject obj=new UiObject(select);
sleep(2000);
obj.setText(Utf7ImeHelper.e("高小庄"));
obj.click();
}
}
文件编码修改为utf-8
引入三个包如下图
编译build步骤:
posted on 2017-04-24 13:03 sunny_2016 阅读(152) 评论(0) 编辑 收藏 举报