UiAutomator Android - setText method doesn't work.!

Now I am trying to use UIAutomator. We are creating an application. When testing the setText method, the UIAutomator doesn't work. When you click EditText, the keyboard will appear. And then set the text for that object, but it doesn't work.

Here's my code for the EditText,

<EditText android:id="@+id/category_editText"
             style="@style/Brown.textBox"
             android:layout_width="match_parent"
             android:layout_height="33dp"
             android:contentDescription="@string/category_editText"
             android:ems="10"
             android:gravity="center_vertical"
             android:hint="@string/category_entry"
             android:lines="1"
             android:maxLength="50"
             android:paddingLeft="3dp"
             android:paddingRight="3dp"
             android:scrollHorizontally="true"
             android:singleLine="true" />

      

Can anyone help me? Thank.

+3


source to share


2 answers


Have you checked the node properties of this field using UIAutomator? Your edit text's clickable property should be set to true. if it is false, this problem may arise. I suggest you check the properties and make the appropriate changes so that the clickable property is true.



+1


source


I faced the same problem. I used legacySetText

instead setText

and worked



0


source







All Articles