Appium finding unnecessary elements

Hi,

When I try to find elements which are actually some 5 or 6 buttons, i used a common xpath that will point to all the 5 buttons and I loop to find its attributes or click it. But what it does is finding elements using instance and displaying like “Element is null: (0) Element is null: (1)”. And the count also it is not returning correctly, If 5 buttons are present it returns like 30 or some wrong count based on the Element is null’s count.

The server log is displayed like,

info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding //[@class=‘android.widget.FrameLayout’]/[@class=‘android.widget.RelativeLayout’]/*[@class=‘android.widget.Button’] using XPATH with the contextId: multiple: true
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.widget.Button, INSTANCE=7]
info: [debug] [BOOTSTRAP] [debug] Element[] is null: (0)
info: [debug] [BOOTSTRAP] [debug] Element[] is null: (1)
info: [debug] [BOOTSTRAP] [debug] Element[] is null: (2)
info: [debug] [BOOTSTRAP] [debug] Element[] is null: (3)
info: [debug] [BOOTSTRAP] [debug] Element[] is null: (4)
info: [debug] [BOOTSTRAP] [debug] Element[] is null: (5)
info: [debug] [BOOTSTRAP] [debug] Element[] is null: (6)
info: [debug] [BOOTSTRAP] [debug] Element[] is null: (7)
info: [debug] [BOOTSTRAP] [debug] Element[] is null: (8)
info: [debug] [BOOTSTRAP] [debug] Element[] is null: (9)
info: [debug] [BOOTSTRAP] [debug] Element[] is null: (10)
info: [debug] [BOOTSTRAP] [debug] Element[] is null: (11)
info: [debug] [BOOTSTRAP] [debug] Element[] is null: (12)
info: [debug] [BOOTSTRAP] [debug] Element[] is null: (13)
info: [debug] [BOOTSTRAP] [debug] Element[] is null: (14)
info: [debug] [BOOTSTRAP] [debug] Element[] is null: (15)
info: [debug] [BOOTSTRAP] [debug] Element[] is null: (16)
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.widget.Button, INSTANCE=8]
info: [debug] [BOOTSTRAP] [debug] Element[] is null: (0)
info: [debug] [BOOTSTRAP] [debug] Element[] is null: (1)

Here I expect the count as 9, but the null element count is 13, so it returns as 144. I am not sure why this is happening. Anyone kindly help.

Thanks,
Vinoth.

@VINOTH_S
I think this might be related to this bug

I fixed this issue in a pull request, once I write a test for it then it’ll be merged.

Thanks all, Updated to Appium 1.2.4 and it works awesome.

Thanks,
Vinoth.

When was 1.2.4 released??? :s

Just today, few hrs back… update ur project … :slight_smile:

What are the new changes??

+CHANGES IN VERSION 1.2.4 (from 1.2.3)

  +======================================



    

    

  +



    

    

  +#### General



    

    

  +- add objective-c examples



    

    

  +



    

    

  +#### iOS



    

    

  +- update appium-instruments with logging fixes



    

    

  +- update appium-instruments with getDevices stalling fix



    

    

  +



    

    

  +#### Android



    

    

  +- give better error for UiScrollable parse exception



    

    

  +- fix UiSelector instance in finds



    

    

  +- use last coordinates for touch release



    

    

  +
1 Like

Works like Fire :wink: