appium / appium-uiautomator2-server

Appium UiAutomator/UiObject2-based server for Android UI automation. This module is used by appium-uiautomator2-driver component
Apache License 2.0
319 stars 227 forks source link

android uiautomator enableMultiWindows bug? #500

Open TesterWa opened 1 year ago

TesterWa commented 1 year ago

set enableMultiWindows:true,getPagesource Only return root,use adb shell dump Return to page source normally,Whether it is a bug of appium. test application Wechat!

KazuCocoa commented 1 year ago

Is it native elements? The enableMultiWindows returns views from as https://github.com/appium/appium-uiautomator2-server/blob/0111c096ac077772eef54b670e990cef42544580/app/src/main/java/io/appium/uiautomator2/utils/AXWindowHelpers.java#L86-L98 , so it returns only root, then the Android's AccessibilityNodeInfo also can show them.

TesterWa commented 1 year ago

是原生元素吗? 来自 as的enableMultiWindows返回视图

https://github.com/appium/appium-uiautomator2-server/blob/0111c096ac077772eef54b670e990cef42544580/app/src/main/java/io/appium/uiautomator2/utils/AXWindowHelpers.java#L86-L98

, 所以它只返回 root,那么 Android 的 AccessibilityNodeInfo 也可以显示它们。

Yes ! Native element get roots It should be normal, but is there any problem with appium-ui2-server in generating the page source? Although the page source generation failed, you can get elements with Android native uiselector, provided that you call driver.source before calling findelement to empty windows in ui2-server. The cache. In order to return the element normally.

KazuCocoa commented 1 year ago

Generally the result by Appium depends on https://developer.android.com/reference/android/app/UiAutomation#getWindows() and https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo. A potential reason was they did not retuirn entire page source.

allowInvisibleElements and ignoreUnimportantViews also could help https://github.com/appium/appium-uiautomator2-driver/#elements-cannot-be-found