This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.
8 / 27
May 2018

And now it is crashing:

[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

Seems to be occurring more frequently now, up to about 75%. Has anyone experienced this?

[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

If you drop the “OR” and query the elements individually, does it continues to break?

P.S. - Try and drop the xpath and use other locators.

What I have been doing in Python Appium for the last two years is stick to find_element_by_android_uiautomator when I have to use Xpath ordinarily. This has been pretty stable to me. Good luck.

I also I see you are using 1000 in WebDriverWait. This is way too short.

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 turn off animation from settings (I always have it turned off. )

disableWindowAnimation = true is what I am using…but does not disable all of them, oddly enough…

As for example, I see: el = self.driver.find_element_by_android_uiautomator(‘new UiSelector().description(“Animation”)’)…but how can that be used in my case where I need Xpath as shown in my example in my original post??

Ok I got the following to work: element = self.driver2.find_element_by_android_uiautomator(‘new UiSelector().text(“From this device”)’)…but how can I add a wait until text is found condition? or wait until text is gone?

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…

Use EC.visibility_of_element_located right before your find_element_by_android_uiautomator call. Two separate statements. Google has been doing a good job and uiautomator by itself alone handles element wait well. So if your screen is dynamic/complicated/long, then I suggest using EC.