android - how to use Instrumentation under the uiautomator project? -
i'm working on uiautomator project , uiobject.getfromparent turn out wrong element me , source code of uiautomator , found out answer because uiselector used.
i found uiautomator using instrumentation ui element stuff :
getinstrumentation().getuiautomation().getrootinactivewindow();
i want accessibilitynodeinfo node uiautomator uiautomator didn't exposed this.
i’m trying way new class extends instrumentationtestcase,by getinstrumentation() return null me.
i found answer on android instrumentation test case - getinstrumentation() returning null needs injectinstrumentation(instrumentationregistry.getinstrumentation());
, told instrumentationregistry official android testing-support-lib:0.1
i have download android support repository , import testing-support-lib-0.1-source.jar project still can't see instrumentationregistry.
anyone have idea cast?
i'm using extension of instrumentationtestcase , works fine this:
@override public void setup() throws exception{ super.setup(); instrumentation instrumentation = instrumentationregistry.getinstrumentation(); accessibilitynodeinfo root = instrumentation.getuiautomation().getrootinactivewindow(); }
i imported
import android.test.instrumentationtestcase; import android.support.test.instrumentationregistry; import android.view.accessibility.accessibilitynodeinfo;
and installed
android support repository (15) android support library (22.2)
hope helps.
Comments
Post a Comment