[debug] [UiAutomator2] [UIAutomator2] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:
[debug] [UiAutomator2] [UIAutomator2] Process crashed while executing startServer(io.appium.uiautomator2.server.test.AppiumUiAutomator2Server):
[debug] [UiAutomator2] [UIAutomator2] java.lang.ArrayIndexOutOfBoundsException: src.length=7 srcPos=0 dst.length=7 dstPos=1 length=7
[debug] [UiAutomator2] [UIAutomator2] at java.lang.System.arraycopy(Native Method)
[debug] [UiAutomator2] [UIAutomator2] at java.util.ArrayList.addAll(ArrayList.java:591)
[debug] [UiAutomator2] [UIAutomator2] at android.view.accessibility.AccessibilityNodeInfo.init(AccessibilityNodeInfo.java:3248)
[debug] [UiAutomator2] [UIAutomator2] at android.view.accessibility.AccessibilityNodeInfo.refresh(AccessibilityNodeInfo.java:903)
[debug] [UiAutomator2] [UIAutomator2] at android.view.accessibility.AccessibilityCache$AccessibilityNodeRefresher.refreshNode(AccessibilityCache.java:564)
[debug] [UiAutomator2] [UIAutomator2] at android.view.accessibility.AccessibilityCache.refreshCachedNodeLocked(AccessibilityCache.java:206)
[debug] [UiAutomator2] [UIAutomator2] at android.view.accessibility.AccessibilityCache.onAccessibilityEvent(AccessibilityCache.java:170)
[debug] [UiAutomator2] [UIAutomator2] at android.view.accessibility.AccessibilityInteractionClient.onAccessibilityEvent(AccessibilityInteractionClient.java:611)
[debug] [UiAutomator2] [UIAutomator2] at android.accessibilityservice.AccessibilityService$IAccessibilityServiceClientWrapper.executeMessage(AccessibilityService.java:1732)
[debug] [UiAutomator2] [UIAutomator2] at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:37)
[debug] [UiAutomator2] [UIAutomator2] at android.os.Handler.dispatchMessage(Handler.java:105)
[debug] [UiAutomator2] [UIAutomator2] at android.os.Looper.loop(Looper.java:164)
[debug] [UiAutomator2] [UIAutomator2] at android.app.ActivityThread.main(ActivityThread.java:6938)
[debug] [UiAutomator2] [UIAutomator2] at java.lang.reflect.Method.invoke(Native Method)
[debug] [UiAutomator2] [UIAutomator2] at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
[debug] [UiAutomator2] [UIAutomator2] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
[debug] [UiAutomator2] [UIAutomator2] INSTRUMENTATION_RESULT: shortMsg=Process crashed.
[debug] [UiAutomator2] [UIAutomator2] INSTRUMENTATION_CODE: 0
Webdriverwait is based in seconds, not milliseconds, so 1000 is substantial actually. @Telmo_Cardoso, it breaks regardless of OR, unfortunately…even if I just look for a single element. I am beginning to think it is all the animations on screen that are causing it to crash.
I will give ‘android_uiautomator’ a try…assuming this will work with uiautomator2, correct?
@mayu Can you give me an actual example of a ‘find_element_by_android_uiautomator’ with a wait? thanks
You can use a FluentWait
FluentWait fluentWait = new FluentWait<>(driver).withTimeout(Duration.ofSeconds(waitTime)).pollingEvery(Duration.ofSeconds(1)).ignoring(NoSuchElementException.class)
return (MobileElement) fluentWait.until(webDriver -> ((AndroidDriver) driver).findElementByAndroidUIAutomator(query));
Is fluentWait really available in Python biding? Unfortunately, in Python, I have been noticing that we do not have all the nice things that APPIUM Java binding offers. (I am sticking to Python because I like the language. )
Use EC right before your find_element_by_android_uiautomator call if you need to.
I just tried:
wait = WebDriverWait(self.driver2, 3000, poll_frequency=1, ignored_exceptions=[ElementNotVisibleException, ElementNotSelectableException])
element = wait.until(EC.invisibility_of_element_located((By.ID, “com.app.example:id/overAllProgressStop”)))
acting as a ‘fluent wait’, but we will see. Next I will try EC call before find by uiautomator.
Thanks guys
I can’t get it to work…@mayu can you please combine element = self.driver2.find_element_by_android_uiautomator(‘new UiSelector().text(“sample”)’) with an EC wait until element is visible (something like WebDriverWait(self.driver2,3000).until(EC.visibility_of_element_located((By.XPATH, “//android.widget.TextView[@text=‘sample’]”))))
I just want to look for a specific text on screen for 3000 seconds using find by uiautomator…