Can you do nested search for elements in appium?

On android nested elements have same ids within linear layout. So I am trying to search for elements within it.

is it possible to do something like this to search for elements within a linear layout?


Java is like - driver.findElements(By.Id (“some_cell_id”)).findElements(MobileBy.classname(“android.widget.seekbar”))


Thanks this works in python something like this:


Unfortunately you cannot call find_element_by_xpath() on an Webdriver Element, apparently that feature has not been implemented. See here:

You can however call other find methods like find_element_by_class() against an element to find children, use XPATH axes, or use some custom code to programmatically compose XPATH by concatenating some XPATH snippets together then calling self.driver.find_element_by_xpath(your_custom_composed_xpath)

Learn about XPATH axis, it provides a LOT of useful methods for locating specific elements via relationships to other elements in the DOM, and you can continue to find very specific elements via attributes such as name.

Start here as it has clear, well detailed examples:

1 Like