0

I am using Pydev in Eclipse to automate an Android app with Appium. I'm not able to click on the element. FrameLayout has different index [0,1,2] rest everything is same.

I have tried these:

driver.find_element_by_android_uiautomator("new UiSelector().className(\"android.widget.FrameLayout[@index = '2']\")").click()

&

driver.find_element_by_xpath("//android.widget.FrameLayout/android.widget.LinearLayout/android.view.ViewGroup/android.widget.LinearLayout[0]/android.widget.RelativeLayout/android.support.v7.widget.RecyclerView/android.widget.FrameLayout[1]").click()

enter image description here

Mario
  • 1
  • 5

1 Answers1

0

You can easily use resource-id as follows -

categoryList = driver.find_element_by_id("categoryListFrameLayout")
for category in categoryList :
    category.click() //do whatever you want to do with the category

Note - If you want to specifically use a indexed element form the list you can refer Accessing the index in Python 'for' loops

Community
  • 1
  • 1
Naman
  • 27,789
  • 26
  • 218
  • 353