How to verify buttons which are like images

232 views Asked by At

when i give a query in terminal like query "* id:'btn_addRemove'"

Then i am getting an output like

    [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}"
    },

Now problem is the "id" is same for both the buttons and when i click on the button , then it will change to green with some image in it and when i click again, the buttton changed to normal one which shows before.

How do i verify this ?

1

There are 1 answers

0
Aravin On

If you have multiple element with same IDs.

Then you can click or verify element using index.

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

Let me know, if you issue get resolved.