<分区>
我试过了
private WebElement getParent(final WebElement webElement) {
return webElement.findElement(By.xpath(".."));
}
但是我得到:
org.openqa.selenium.InvalidSelectorException: The given selector .. is either invalid or does not result in a WebElement. The following error occurred: InvalidSelectorError: The result of the xpath expression ".." is: [object XrayWrapper [object HTMLDocument]]. It should be an element. Command duration or timeout: 10 milliseconds For documentation on this error,
有没有办法获取当前元素的父元素?谢谢