各位大佬麻烦看看,同一个 app 程序 android8 使用 appium desktop 获取元素要比 android10 多一个控件元素,android10 是无法获取到 android8 找到的那个 id,也不知道啥原因。一脸懵逼


MI 5X 的 android8 获取到的 appium desktop

MI 5X 的 android8 获取到的 xml

<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<hierarchy index="0" class="hierarchy" rotation="0" width="1080" height="1920">
  <android.widget.FrameLayout index="0" package="com.whole.beauty" class="android.widget.FrameLayout" text="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[49,679][1030,1312]" displayed="true">
    <android.widget.FrameLayout index="0" package="com.whole.beauty" class="android.widget.FrameLayout" text="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[49,679][1030,1312]" displayed="true">
      <android.widget.FrameLayout index="0" package="com.whole.beauty" class="android.widget.FrameLayout" text="" resource-id="android:id/content" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[49,679][1030,1312]" displayed="true">
        <android.widget.LinearLayout index="0" package="com.whole.beauty" class="android.widget.LinearLayout" text="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[49,679][1030,1312]" displayed="true">
          <android.widget.LinearLayout index="0" package="com.whole.beauty" class="android.widget.LinearLayout" text="" resource-id="com.whole.beauty:id/ll_ad" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[49,679][1030,1312]" displayed="true">
            <android.widget.ImageView index="0" package="com.whole.beauty" class="android.widget.ImageView" text="" resource-id="com.whole.beauty:id/iv_ad" checkable="false" checked="false" clickable="true" enabled="true" focusable="true" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[49,679][1030,1192]" displayed="true" />
            <android.widget.ImageView index="1" package="com.whole.beauty" class="android.widget.ImageView" text="" resource-id="com.whole.beauty:id/iv_close" checkable="false" checked="false" clickable="true" enabled="true" focusable="true" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[500,1234][578,1312]" displayed="true" />
          </android.widget.LinearLayout>
        </android.widget.LinearLayout>
      </android.widget.FrameLayout>
    </android.widget.FrameLayout>
  </android.widget.FrameLayout>
</hierarchy>

MI 5X 的 android8 获取到的运行的脚本


Mi 10 的 android10 获取到的 appium desktop

Mi 10 的 android10 获取到的 xml

<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<hierarchy index="0" class="hierarchy" rotation="0" width="1080" height="2206">
  <android.widget.FrameLayout index="0" package="com.whole.beauty" class="android.widget.FrameLayout" text="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[49,876][1030,1509]" displayed="true">
    <android.widget.FrameLayout index="0" package="com.whole.beauty" class="android.widget.FrameLayout" text="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[49,876][1030,1509]" displayed="true">
      <android.widget.FrameLayout index="0" package="com.whole.beauty" class="android.widget.FrameLayout" text="" resource-id="android:id/content" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[49,876][1030,1509]" displayed="true">
        <android.widget.LinearLayout index="0" package="com.whole.beauty" class="android.widget.LinearLayout" text="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[49,876][1030,1509]" displayed="true">
          <android.widget.LinearLayout index="0" package="com.whole.beauty" class="android.widget.LinearLayout" text="" resource-id="com.whole.beauty:id/ll_ad" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[49,876][1030,1509]" displayed="true">
            <android.widget.ImageView index="0" package="com.whole.beauty" class="android.widget.ImageView" text="" resource-id="com.whole.beauty:id/iv_ad" checkable="false" checked="false" clickable="true" enabled="true" focusable="true" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[49,876][1030,1389]" displayed="true" />
          </android.widget.LinearLayout>
        </android.widget.LinearLayout>
      </android.widget.FrameLayout>
    </android.widget.FrameLayout>
  </android.widget.FrameLayout>
</hierarchy>

Mi 10 的 android10 获取到的运行的脚本


↙↙↙阅读原文可查看相关链接,并与作者交流