2017-02-11 46 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產生。