Reputation: 181
i'm trying to update Appium version from 0.16 to 1.2 (ios, Java) on the old version i'm using webElement.findElements(By.xpath("*")) to get all webElement's child elements. this syntax doesn't work on 1.2 version.
any ideas how can i get all child elements?
Thanks,
Idan
Upvotes: 2
Views: 2186
Reputation: 7339
I would recommend you to consider CSS selector alternative as CSS working faster than xPath. So the common rule is following:
B as a descendant of A : children, grandchildren etc.
A B
B as a child of A
A > B
all elements
*
So select all child elements from all elements on the page:
* > *
So in java it be:
List<WebElement> a = driver.findElements(By.cssSelector("* > *"));
Hope this helps you.
Upvotes: 1