Hi all! This is a question using Java syntax and APIs, but I'm sure the core of the question will apply equally well to all supported languages.
I remember searching by Xpath a long time ago on WebElements (more specifically, they are MobileElements, but all MobileElement types extend from WebElement). For example, I retrieved an AndroidElement like so:
AndroidElement myElement = driver.findElement(Some locator);
I then tried to search for descendant elements of myElement using Xpath by passing in an Xpath locator to the AndroidElement's findElement method:
myElement.findElement(By.xpath("//android.widget.TextView"));
I remember that this operation was not supported, and I probably got some exception. However, quite a long time has passed since I tried doing something like this, and I'm wondering if the current Appium supports searching by Xpath with a given element as the root. It would be neat to be able to set the search scope to be only children of a particular element without having to specify an Xpath to specify the ancestor element each time.
I'll test this out over this weekend as well to see what's up, but if anyone knows about this already, it would be neat to know quickly!
It's also possible my Xpath syntax may be wrong. If it is, definitely point it out.