Mobile Object Property with different class name

I have Mobile Object with different class name on different device(Emulator and Real Device).

//*[@class = ‘android.widget.TextView’ and (@text = ‘Debit Account’ or . = ‘Debit Account’)]

//*[@class = ‘android.view.View’ and (@text = ‘Debit Account’ or . = ‘Debit Account’)]

How can we specify the class name so that I can run the test in both environments.?

My Current property file is like below.

@kazurayam - Can you please help me on this?

//*[ ( @class = ‘android.widget.TextView’ or @class = 'android.view.View' )
       . = ‘Debit Account’
1 Like

This XPath expression is meaninglessly verbose.

//*[. = ‘Debit Account’]

is equivalent, shorter so that better

@kazurayam - Thanks for your quick reply.

I’m sorry for asking you directly. I understood your concern. I have reached out to you because you are always the first person to help out.

I have written the testcases and working fine on one device. While checking on another device, the class name got changed from ‘android.view.View’ to ‘android.view.TextView’ or ‘android.widget.TextView’.

Using without class name it recognize multiple objects. So I used class name and text attributes for the Objects.