需求分析
找到主页界面中的5个控件按钮 挨个点击
上代码
package cn.vlang.test01;
import android.os.RemoteException;
import com.android.uiautomator.core.UiObject;
import com.android.uiautomator.core.UiObjectNotFoundException;
import com.android.uiautomator.core.UiSelector;
import com.android.uiautomator.testrunner.UiAutomatorTestCase;
public class Uidevice extends UiAutomatorTestCase{
public void testDemo() throws UiObjectNotFoundException, RemoteException{
getUiDevice().pressMenu();
getUiDevice().pressBack();
UiObject bn = new UiObject(new UiSelector().text("Phone"));
bn.click();
getUiDevice().pressBack();
bn = new UiObject(new UiSelector().text("Contacts