1

当我在终端中进行查询时,例如查询“* 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”是相同的,当我点击按钮时,它会变成绿色,里面有一些图像,当我再次点击时,按钮变成之前显示的正常按钮。

我如何验证这一点?

4

1 回答 1

0

如果您有多个具有相同 ID 的元素。

然后您可以使用索引单击或验证元素。

query("ImageView css:'#'btn_addRemove'")[0]

让我知道,如果您的问题得到解决。

于 2015-07-31T07:37:32.413 回答