Reputation: 309
I am locating element for android application and have one query. I am storing list of web elements as below
List<WebElement> trackingsList = tracking.getTrackingElements();
getTrackingElements() is function that is returning list of WebElements and is returning elements fine, this is checked.
now I want to get a child element of the webelement at position trackingList.get(0) using xpath.
so i tried like
trackingsList.get(0).findElement(By.xpath("//android.widget.LinearLayout"))
but it is not working. any help really appreciated.
Upvotes: 2
Views: 903
Reputation: 42528
To get the targeted element by class name :
trackingsList.get(0).findElement(By.className("android.widget.LinearLayout"));
And by tag name:
trackingsList.get(0).findElement(By.tagName("LinearLayout"));
Upvotes: 2