xpath - Appium : How to select a checkbox from a native Android application -
i want select checkbox list of fruit names .
eg .
1.apple [✔]
2.mango [✔]
3.banana [✔]
this entire 1 row in 1 relative layout , text view , checkbox .
relative layout[parent]
- //android.widget.textview[@text='mango']
- //android.widget.checkbox[@text='liked']
now have written function selecting fruit clicking on checkbox , xpath not returning element.
public static void likefruit(string fruitname){ driver.findelement(by.xpath("//android.widget.textview[@text='"+fruitname+"']/following-sibling::android.widget.checkbox[@text='liked']")).click(); }
i have tried below xpath , nothing working .am doing wrong?
1.//android.widget.textview[@text='"+fruitname+"']/../android.widget.checkbox[@text='liked'] 2.//android.widget.textview[@text='"+fruitname+"']/following-sibling::*[1]
Comments
Post a Comment