【发布时间】:2017-11-26 18:21:51
【问题描述】:
我在使用 wd 的 nodejs 上有一个 appium(android 黑盒测试)问题:
目前我无法获得兄弟元素。 Id 不是唯一的,架构始终相同 ->
ListView
|
|
Frame
| |
| |
| TextView[@text headline0]
| |
| |
| Button //no text - just an icon
|
Frame
| |
| |
| TextView[@text headline1]
| |
| |
| Button //no text - just an icon
|
Frame
| |
...
我的问题是,我想单击例如旁边的按钮。标题 9.我写了一个scrollToElement(title) 函数,只要“headline9”可见,它就会滚动..
但是现在我不能使用像 [//Frame[@index="9"]/] 这样的 xpath,因为在当前可见区域中索引似乎又从 0 开始......所以也许 @index="9" 变成了 @index=2 或者有时是 @index=1。 .
现在我的想法是使用以下方式选择按钮:
.elementByXPath("//android.widget.TextView[@text='headline9']/../android.widget.Button")
但是好像不行(找不到元素)
还有其他人有想法吗?
非常感谢!
【问题讨论】: