I have automated a production app (dont have control over it's source code) using appium but in an attempt to speed up this automation I would like to remove a dynamic animated element (with class android.view.Viewgroup) from UI which is slowing down the UI query response time. Preferably, a shell command using adb by specifying a UISelector query would be amazing!

Full disclosure: I dont fully understand the android UI model as well as I do say browser's DOM. And the ability to hide/remove an element on DOM in browsers is easy. However, android doesnt seem to support any straight forward API to remove a rendered UI element. I suspect this is because UI model is more closely linked to OS internals in android and any attempt to alter expected rendering behavior would trigger fatal errors.

In simple terms, I would like to replicate the browser's document.getElementById("ded").remove() behaviour for android's native view model.

Potential Solution
While not officially supported, I'm confident this can be achieved with View#setVisibility api using a rooted device and some form of code injection during runtime using frameworks like Xposed. I'm happy to check in at xda forum if discussing about it is not supported here.

I would greatly appreciate any insight into libraries/modules/apps that may already provide this functionality. Thank you in advance!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.