I am trying to check if element exist, but appium seems to ignore searching an element when we specified that it should be inside another element. For example:
driver.findElementByAccessibilityId("First element").findElementByAccessibilityId("Second element");
It should work somehow since there is option in Appium inspector called Locator where after selecting strategy and choosing search from selected element option it finds what I expect.
What is the proper way of finding such elements ?
Simple solution but not the cleanest below:
I am using TestNG framework which I suppose do not allow declarations such as
Simple solution but not the best is to declare only parents as:
Then in test case for example:
Put the first element as parent and second element as child -
You can use a xpath for the same. Sample xpath for the situation will be like :
The // between first element and second element indicates first element is the base element for start searching the second element. So it will search for the second element between the scope of the first element