android - Trigger UIAutomator Test Script programatically -
we using uiautomator
automation.
to run uiautomator
test scripts used compile scripts command prompt using either usb
or wifi
adb , run on android device.
uiautomator
scripts come in jar format after compilation. push jar in device , have trigger test scripts. command start test script in “adb shell uiautomator runtest testpackage.jar
”.
it working normal adb connection.
but in our case have initiate test scripts without adb connection.
so tried passing commands programmatically in device using java code
try { stringbuffer output = new stringbuffer(); process p = runtime.getruntime().exec(params[0]); bufferedreader reader = new bufferedreader(new inputstreamreader( p.getinputstream())); string line = ""; while ((line = reader.readline()) != null) { output.append(line + "\n"); p.waitfor(); } } catch (ioexception e) { e.printstacktrace(); } catch (interruptedexception e) { e.printstacktrace(); }
after execution getting following exception:
java.lang.securityexception : longmsg = not have android.permission.retrieve_window_content required call registeruitestautomationservice
if run scripts command prompt adb connection working. if tried command programmatically getting exception.
we came know above mentioned issue can overcome in rooted android device enabling retrieve_window_content
permission. want scripts run on non-rooted setup.
can me in explaining security permission issue?
how can resolve it?
Comments
Post a Comment