This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.
3 / 3
Sep 2018

Hi all

I am studying about Appium and I can’t count child in RecyclerView.
of course, I already red all of thing about this problem in this site but I can’t solve it.

this is the app’s hierarchy that I want to test.
And I wanna click RelativeLayout that child of RecyclerView.

However I cant I dont know why.

I try two way,

test_driver.findElement(By.xpath("//android.support.v7.widget.RecyclerView3[0]/android.widget.RelativeLayout")).click();

List list =test_driver.findElements(By.id(“com.sample:id/list”))
list.get(0).click()

but it both don’t work.
please help me, I spent 2 days for solving this problem.

  • created

    Jun '18
  • last reply

    Sep '18
  • 2

    replies

  • 590

    views

  • 3

    users

  • 1

    like

  • 2

    links

3 months later

I have a similar problem except that I cannot find nor grab any element in Recycler view at all, even though finding elements in other views works perfectly. Executing find_element_by_xpath starts, but doesn’t stop. And methods find_element_by_id or find_element_by_android_uiautomator complain that the element I am looking for could not be located on the page by throwing an exception.

I have sometimes solved this by getting all the subelements in the Recycler view. Assuming the parentElement is your recyclerView something like this (I have wrapped creating the ‘by’ of a UiSelector, so this probably isn’t perfect). You should be able to also give the classname instead of “.*”

List results = parentElement.findElements(MobileBy.AndroidUIAutomator(“new UiSelector().classNameMatches(”.*")"));