android - 如何在 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 ();
解决方案
如果你想找到所有的“FOLLOW”按钮,你可以使用这个 XPath://android.widget.Button[@text = 'FOLLOW']
推荐阅读
- c# - 如何解决“该进程无法访问文件'C:\Folder\New Text Document.txt',因为它正被另一个进程使用”?
- git - 如何避免 git 合并冲突?
- http - haproxy:设置 POST 正文
- java - 纯 Java API 中出现意外的非空类型
- android-studio - HEIC图像透明背景为黑色
- mqtt - Mosquitto-动态桥接
- android - 从一个导航图导航到另一个导航图android
- optimization - 通过实现 fmin_slsqp() 使用 KKT 解决非线性优化问题
- ios - 如何在 iOS Swift 中使用 CarbonKit 创建动态选项卡和视图控制器?
- angular - 角度7中的延迟加载