📜  从子aWebelement selenium java代码示例中检索父元素

📅  最后修改于: 2022-03-11 14:52:39.263000             🧑  作者: Mango

代码示例1
WebElement myElement = driver.findElement(By.id("myDiv"));
WebElement parent = (WebElement) ((JavascriptExecutor) driver).executeScript(
                                   "return arguments[0].parentNode;", myElement);