Cod*_*tic 40 java collections selenium webdriver
有这个元素有子元素,那些子元素又有子元素等等.我想得到作为元素后代的所有元素.谢谢.
Igo*_*rol 83
试试这个:
(JAVA)
List<WebElement> childs = rootWebElement.findElements(By.xpath(".//*"));
Run Code Online (Sandbox Code Playgroud)
(C#)
IReadOnlyList<IWebElement> childs = rootWebElement.FindElements(By.XPath(".//*"));
Run Code Online (Sandbox Code Playgroud)
试试这个
List<WebElement> allDescendantsChilds = rootWebElement.findElements(By.xpath("//tr[@class='parent']//*"));
Run Code Online (Sandbox Code Playgroud)
上面的内容将为您提供父tr的所有后代子元素(不仅是直接子元素)
| 归档时间: |
|
| 查看次数: |
77507 次 |
| 最近记录: |