Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'.exists' calls timing out or taking a LONG time to complete if I have a field on screen with constantly updating text #322

Open
brettnolan opened this issue Mar 25, 2024 · 1 comment

Comments

@brettnolan
Copy link

I am trying to automate testing of an android application.
Everything was working fine until the developers added a text field to one screen that is updating every 100ms.

With that field visible on the screen, even a simple
device(resourceId="<object_id_str>").exists

request takes at least 2-3 times longer to complete (if the updating text field is present on the screen)....7s vs 17s .
And if I am checking for the existence of multiple items, then the time increases exponentially,
in fact, I've seen it take over 2 mins to complete or JASONRPC times out while trying to handle it.

Has anyone else run into this issue?
I cannot be the first person to have a constantly updating text field on the screen.
How can I get around this as it is completely breaking my existing automation. :(

@brettnolan brettnolan changed the title JSONRPC calls timing out or taking a LONG time to complete if I have a field on screen with constantly updating text '.exists' calls timing out or taking a LONG time to complete if I have a field on screen with constantly updating text Mar 25, 2024
@unofficialdxnny
Copy link

1. Optimize Wait Strategies

Try using more efficient wait strategies that are less impacted by rapidly changing content.

Explicit Waits: Instead of checking for existence alone, wait for specific conditions or stable states. This can help if you can identify when the page or element is stable.

# Example: Wait for a stable element to indicate the state is stable
device(resourceId="some_stable_element_id").wait.exists(timeout=10000)

2. Profiling and Debugging

Use profiling tools, such as Android Profiler, to diagnose performance bottlenecks. These tools can help you determine if the issue is related to the updating field or another factor.

Summary

The constant updating of the text field is likely causing performance issues in your automated tests with UIAutomator. By optimizing wait strategies, excluding irrelevant elements, and improving test design, you should be able to mitigate the impact and enhance your test performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants