2017-02-11 140 views
0

我正在使用Android Ui Automator进行联系人应用程序的功能测试。我的手机是LG D型号。 无法切换到其他Android用户界面元素,我尝试了下面的代码 通过使用UiObject,甚至UiScrollable类。如何使用Ui Automator类切换到其他Android Ui元素

UiScrollable phoneContSwipe = new UiScrollable(new UiSelector().scrollable(true)); 

    UiObject nameTest=phoneContSwipe.getChild(new UiSelector().text("Name")); 
    nameTest.setText("Ramu"); 

    UiObject phoneText=phoneContSwipe.getChild(new UiSelector().text("Phone")); 
    phoneText.setText("11111111111"); 

现在发生的是,nameText和phoneText正在输入相同的字段。

+0

您好,我已经使用了直接代码,用于自动执行contactsAdding。像UiObject obj1 = new UiObject(new UiSelector()。text(“Name”)); obj1.setText( “瑞木”); 。 'nameText'和'phoneText'元素都出现在相同的Ui页面上。 我以为滚动没有发生。然后我使用UiScrollable类。 即使它没有工作 – Ram

回答

0

可正常工作

mDevice.findObject(By.clazz("android.widget.EditText").text(Pattern.compile("Name")).pkg("com.android.contacts")).setText("Ramu"); 
mDevice.findObject(By.clazz("android.widget.EditText").text(Pattern.compile("Phone")).pkg("com.android.contacts")).setText("11111111111"); 

它会自动使用CulebraTesterText Input Feature产生。