首页 > 解决方案 > 如何在 Android 自动化中选择多个元素

问题描述

我对 Android 自动化非常陌生。请帮助找到下图中的“关注”按钮。我想选择任意 2 个 FOLLOW 按钮。我什至尝试使用 List WebElements。但仍然无法破解这个。在此处输入图像描述

我试过下面的xpath。但我收到 NosuchElementException 消息。

driver.findElementByXPath("//com.onefc.android.app:id/athlete_name_text[@text='Aung La N Sang']/following-sibling::android.widget.RelativeLayout/android.widget.Button").click ();

标签: androidmobileautomationappium-android

解决方案


如果你想找到所有的“FOLLOW”按钮,你可以使用这个 XPath://android.widget.Button[@text = 'FOLLOW']


推荐阅读