How do I select an element by its dynamic content-desc attribute?

I have elements on a screen that have dynamic content-desc attributes.
The content-desc looks like this: report_description_textview_X_lines where ‘X’ can be a value from 0 to 3.

I want to be able to select all elements, even if they have different values for X.

(I am using Python and Appium in Android Automation)

Hi, use find_elements_by_accessibility_id() method to select the elements.
i think you can try this:
elements = driver.find_elements_by_accessibility_id(" report_description_textview_* ")
in this way you should select all the elements whose content-desc starts with “report_description_textview_”.


Hello, maybe in this case you can use FindElementByXPath in case your element doesn`t have a FindElementById or FindElementByAccessibilityId