Status Update
Comments
bl...@google.com <bl...@google.com> #2
pe...@google.com <pe...@google.com> #3
Is your HTML in a WebView? There is a known issue with WebViews + UiAutomator (UiAutomator depends on a11y data, but WebViews generate this information asynchronously when first accessed which creates a race condition between that process and the UiAutomator search).
There are some workaround such as finding the root node of the WebView and waiting for the a11y data to be generated.
If not, can you provide some sample code that reproduces the issue?
pa...@congstar.net <pa...@congstar.net> #4
pa...@congstar.net <pa...@congstar.net> #5
pa...@congstar.net <pa...@congstar.net> #6
pa...@congstar.net <pa...@congstar.net> #7
I'm trying to provide a code snippet, but somehow all my comments get deleted and I don't know why. Your suggestion improved the situation, but didn't fix it completely. The problem now occurs a bit less regularly.
Maybe using markdown for showing the code is the problem with my previous comments. This is the code I used in a minimal example:
val obj = device.wait(Until.findObject(By.res("com.example.uitestapplication", "button_first")), 10000L)
obj.click()
var rootNode: AccessibilityNodeInfo? = instrumentation.uiAutomation.rootInActiveWindow
while (rootNode == null || rootNode.childCount == 0) {
rootNode = instrumentation.uiAutomation.rootInActiveWindow
}
val contents = device.wait(Until.findObject(By.res("contents")), 10000L)
assertNotNull(contents)
If you wish I can provide the whole example project.
fo...@gmail.com <fo...@gmail.com> #8
ึ
Description
Artifact used: androidx.test.uiautomator:uiautomator Version used: 2.2.0 Theme used: Custom Devices/Android versions reproduced on: Fairphone 4, Pixel 6, Pixel 4a, Android 11, Android 10, Android 12
Hi, I'm not sure what caused this issue but i hope I'm here in the right place. We have a problem with our UI tests. We are accessing a simple html page with UIAutomator to trigger some actions in our App Backend. But since we updated the google play services on our test devices UIAutomator cannot find all html tags but on the device they are all visible. Since we diidn't touch the code for these tests, we were curios where the erros comes from. We narrowed it down to an update on the tests devices. We are using custom tabs to display the html page.
We call
With the resource Id of the html object. In most cases it works without issues, but sometimes it cannot find the element. Within 10 test runs there were at least 3 failures with this issue. We have now worked out a "fix" which reloads the page if the element cannot be found. After the reload we could see this error again. But in our opinion this should workd on the first try as well.
If you need more information I am happy to provide them if I can.
Best regards
Pascal Maczey