Search code examples
androiddumpandroid-uiautomatorandroidviewclient

the dump problem of AndroidViewClient: The views are being refreshed too frequently to dump


I need to use AndroidViewClient to do some automated testing. In my code, I use dump() of the ViewClient. But I usually meet the following mistake:

RuntimeError: The views are being refreshed too frequently to dump.

It may raise by this:

ERROR: could not get idle state.

dtmilano (the author of Android Application Testing Guide) answered a similar problem in this question. He said there is a uiautomator limitation.

But my API's number is 19, Why there is still a uiautomator limitation? And how can I deal with this problem? How to use waitforidle()?


Solution

  • It's a UiAutomator limitation.

    As I mentioned in the other answer, an alternative is to use system ViewServer as the backend if your device has secure mode disabled or LocalViewServer if your device is in secure mode but you have access to the source code of the application under test.

    EDIT

    ViewCliet copes with the differences in the aforementioned backends. That is the same script could run unchanged using a different back end.

    For example, to force dump to use ViseServer just run

    $ dump --force-view-server-use --all
    

    You can do the same in your scripts.