Get all immediate children and nothing deeper
<html>
<body>
<div>
</div>
<span>
<table>
</table>
</span>
</body>
</html>
The expected result is div
and span
..
("*")
gives all the child elements of the context node. So use:
WebElement body = browser.findElement(By.xpath("//body"));
body.findElement(By.xpath("*"));; // I want to get all child elements
// inside body, but nothing deeper.