1. XPath using class and text attribute :
xpath("//android.widget.Button[@text='5']")
2. XPath using class and resource-id :
xpath("//android.widget.Button[contains(@resource-id,'digit5')]")
3. XPath using class, text attribute and resource-id :
xpath("//android.widget.Button[contains(@resource-id,'digit5') and @text='5']")
4. XPath using class, text attribute and index :
xpath("//android.widget.Button[@text='5' and @index='1']")
5. XPath using parent and child class hierarchy
xpath("//android.widget.LinearLayout[@index='1']/android.widget.Button[@index='1']")
6. XPath using content-desc
xpath("//android.widget.Button[@content-desc='delete']")
7. XPath using class name
xpath("//android.widget.ImageButton")
xpath("//android.widget.Button[@text='5']")
2. XPath using class and resource-id :
xpath("//android.widget.Button[contains(@resource-id,'digit5')]")
3. XPath using class, text attribute and resource-id :
xpath("//android.widget.Button[contains(@resource-id,'digit5') and @text='5']")
4. XPath using class, text attribute and index :
xpath("//android.widget.Button[@text='5' and @index='1']")
5. XPath using parent and child class hierarchy
xpath("//android.widget.LinearLayout[@index='1']/android.widget.Button[@index='1']")
6. XPath using content-desc
xpath("//android.widget.Button[@content-desc='delete']")
7. XPath using class name
xpath("//android.widget.ImageButton")
0 Comments