Git Product home page Git Product logo

Comments (5)

otw avatar otw commented on June 12, 2024

Thanks for reporting this! This seems to be an issue in UIAutomator itself. I'll look into it and hopefully we can fix it asap. I'm also closing this issue here as it is unrelated to the actual samples.

from testing-samples.

otw avatar otw commented on June 12, 2024

Just t give you a heads up, this bug was already fixed internally and will be in the next release of the support library.

from testing-samples.

thomasthiebaud avatar thomasthiebaud commented on June 12, 2024

I encouter the same problem, but I can go throw by setting an empty hint. Something like

    <EditText
        android:id="@+id/password_input"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="text"
        android:hint="" />

But even with a default hint, this is not working with an inputType set to textPassword. Here is the stack trace. I don't know if you also fix this one internally.

    java.lang.NullPointerException
        at android.support.test.uiautomator.UiObject2.setText(UiObject2.java:601)
        at com.zenika.aic.demo.login.LoginTestCase.loginSuccess(LoginTestCase.java:151)
        at com.zenika.aic.demo.login.LoginTestCase.testUS4(LoginTestCase.java:80)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.junit.runners.Suite.runChild(Suite.java:128)
        at org.junit.runners.Suite.runChild(Suite.java:27)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
        at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:54)
        at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:228)
        at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)


from testing-samples.

yuypa avatar yuypa commented on June 12, 2024

On Android APK <= 19, UiAutomator up to 2.1.2 fails with the when
UiObject2 txtField = getEditTextByAnyMeans();
txtField.setText("blah");

the reason is quite simple ( UiObject2.java:601 ):

    CharSequence currentText = node.getText();
    if (!text.equals(currentText)) {
        ...
        if (!node.performAction(AccessibilityNodeInfo.ACTION_SET_SELECTION, args) &&
                currentText.length() > 0) {
            // TODO: Decide if we should throw here
            Log.w(TAG, "AccessibilityNodeInfo#performAction(ACTION_SET_SELECTION) failed");
        }

node.getText() is returning null and currentText is null , and "currentText.length()" is causing the app to crash.

from testing-samples.

prabintim avatar prabintim commented on June 12, 2024

Was it ever solved? I am seeing the exact same issue with API 18 where my EditText is inside TextInputLayout.

from testing-samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.