appium + cucumber,语言 ruby
我用 uiautomatorviewer 检查会看到
然后用脚本只到了 uiautomatorviewer 看到的 imageview 那里,下面的元素就没有。
current_activity
#.LoginActivity
get_source
#<?xml version="1.0" encoding="UTF-8"?>
<hierarchy rotation="0">
<android.widget.FrameLayout index="0" text="" class="android.widget.FrameLayout" package="Package_name" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,0][1080,1776]" resource-id="" instance="0">
<android.widget.LinearLayout index="0" text="" class="android.widget.LinearLayout" package="Package_name" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,0][1080,1776]" resource-id="" instance="0">
<android.widget.FrameLayout index="0" text="" class="android.widget.FrameLayout" package="Package_name" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,0][1080,1776]" resource-id="" instance="1">
<android.view.View index="0" text="" class="android.view.View" package="Package_name" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,0][1080,1776]" resource-id="Package_name:id/decor_content_parent" instance="0">
<android.widget.FrameLayout index="0" text="" class="android.widget.FrameLayout" package="Package_name" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,0][1080,1776]" resource-id="android:id/content" instance="2">
<android.widget.RelativeLayout index="0" text="" class="android.widget.RelativeLayout" package="Package_name" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,0][1080,1776]" resource-id="" instance="0">
<android.view.View index="0" text="" class="android.view.View" package="Package_name" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,0][1080,1776]" resource-id="Package_name:id/sliding_layout" instance="1">
<android.widget.RelativeLayout NAF="true" index="0" text="" class="android.widget.RelativeLayout" package="Package_name" content-desc="" checkable="false" checked="false" clickable="true" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,0][1080,1776]" resource-id="Package_name:id/modules_page" instance="1">
<android.widget.ImageView index="0" text="" class="android.widget.ImageView" package="Package_name" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[240,846][839,929]" resource-id="Package_name:id/ef_logo" instance="0"/>
</android.widget.RelativeLayout>
</android.view.View>
</android.widget.RelativeLayout>
</android.widget.FrameLayout>
</android.view.View>
</android.widget.FrameLayout>
</android.widget.LinearLayout>
<android.view.View index="1" text="" class="android.view.View" package="Package_name" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,1776][1080,1920]" resource-id="android:id/navigationBarBackground" instance="2"/>
</android.widget.FrameLayout>
</hierarchy>
最后说一下,我们的业务需求是打开 app 之后先是一张图片,然后等 3 秒出来 username 和 password 的输入框,我看开发是将所在的 relativelayout 放在了 里面,是不是因为这个原因?如果是的话,有解吗?