Element is not currently interactable and may not be manipulated

时间:2022-02-01 23:42:45

Element is not currently interactable and may not be manipulated:元素当前不可交互,并且可能无法操作.

解决方法:

调用该方法,智能等待元素加载出来

public void waitForElementToLoad(int timeOut, By by) {
new WebDriverWait(currentDriver, timeOut).until(new ExpectedCondition<Boolean>() {

@Override
public Boolean apply(WebDriver driver) {
WebElement element = driver.findElement(by);
return element.isDisplayed();
}

});
}