Get all immediate children and nothing deeper

后端 未结 4 1508
别跟我提以往
别跟我提以往 2021-02-03 21:20
WebElement body = browser.findElement(By.xpath(\"//body\"));

body.findElement(By.xpath(\"\")); // I want to get all child elements 
                                // i         


        
4条回答
  •  别那么骄傲
    2021-02-03 21:24

    ("*") gives all the child elements of the context node. So use:

    body.findElement(By.xpath("*"));
    

提交回复
热议问题