There is a calendar layout hierarchy. I'd like to locate each element in the ViewGroup. I can achieve it by hardcoding the Whole XPath, apparently it's quite un-efficient. Is there any better approach to do this?
Screenshot and the Hierarchy are given blow:
I've figured out a simple way myself:
Grid.androidDriver().findElementByXPath("//*[@resource-id='com.{path}:id/header_layout']/following::android.widget.LinearLayout[1]/descendant::android.widget.FrameLayout[@enabled='true']/android.widget.TextView[contains(@text,'"+date+"')]").click();