How to get all descendants of an element using webdriver?

0
0

There is this element which has child elements, those child elements again have child elements and so on. I would like to get all elements that are descendants of the element. Thanks.

  • You must to post comments
0
0

Try this one:

(Java)

List<WebElement> childs = rootWebElement.findElements(By.xpath(".//*"));

(C#)

IReadOnlyList<IWebElement> childs = rootWebElement.FindElements(By.XPath(".//*"));
  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website