当我在终端中给出一个查询时 查询" * id:' btn_addRemove'"
然后我得到像
这样的输出 [0] {
"id" => "btn_addRemove",
"enabled" => true,
"contentDescription" => nil,
"class" => "android.widget.ImageView",
"rect" => {
"center_y" => 353,
"center_x" => 622,
"height" => 120,
"y" => 293,
"width" => 140,
"x" => 552
},
"tag" => nil,
"description" => "android.widget.ImageView{4307ec68 V.ED..C. ........ 552,35-692,155 #7f06006e app:id/btn_addRemove}"
},
[1] {
"id" => "btn_addRemove",
"enabled" => true,
"contentDescription" => nil,
"class" => "android.widget.ImageView",
"rect" => {
"center_y" => 559,
"center_x" => 622,
"height" => 120,
"y" => 499,
"width" => 140,
"x" => 552
},
"tag" => nil,
"description" => "android.widget.ImageView{430557b8 V.ED..C. ........ 552,35-692,155 #7f06006e app:id/btn_addRemove}"
},
现在问题是" id"对于这两个按钮是相同的,当我点击按钮时,它会变为绿色,其中有一些图像,当我再次点击时,按钮变为正常,之前显示。
我该如何验证?
答案 0 :(得分:0)
如果您有多个具有相同ID的元素。
然后,您可以使用索引单击或验证元素。
query("ImageView css:'#'btn_addRemove'")[0]
如果您发出问题,请告诉我。