java.lang.SecurityException: Permission Denial: getIntentSender() when using UiAutomation in a test

时间秒杀一切 提交于 2019-12-03 11:21:32

This isn't an answer for why UIAutomator isn't catching the error, but rather a possible workaround that I found. When accessibility services are on I am unable to get an UIAutomator dump because I receive the error you described. When I turn off TalkBack and/or Switch Access in the Accessibility settings I no longer get the Permission Denial error and UIAutomator dump works successfully. Not sure if this will help you, but I can reproduce your issue every time with accessibility services ON in Lollipop(Nexus 5).

Use InstrumentationRegistry.getTargetContext() instead of InstrumentationRegistry.getContext()

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!