Katalon Selenium 元素可见但显示为 false

Katalon Selenium Element is visible but displayed is false

我正在尝试点击 vue js 中的按钮 vuetify with selenium/katalon. It is fully visible in the UI but still can be clicked on. I can find the element with no issues, but clicking on it returns a element not visible error. I tried various solutions 包括:

调试时我注意到以下几点:

// Able to find element with no issues
WebDriver driver = DriverFactory.getWebDriver();
String xPathForButton = "//div[@id='validationStepper']/div[3]/div[1]/div/div[2]/fieldset/div[1]/div/div/div/div[3]/button[1]";
def element = driver.findElement(By.xpath(xPath));
// Element not visible exception
element.click();

KeywordUtil.logInfo('X: ' + element.getLocation().x); // Prints 0
KeywordUtil.logInfo('Y: ' + element.getLocation().y); // Prints 0
KeywordUtil.logInfo('Element is enabled: ' + element.isEnabled()); // Prints true
KeywordUtil.logInfo('Element is displayed: ' + element.isDisplayed()); // Prints false

我需要使用 xpath 来查找这个元素。有人可以帮助我如何正确检测和点击这个元素吗?

问题原来是父元素在运行时 display: none。虽然我最初没有显示 none 的父元素,但 CSS 动态更改,导致发生这种情况。我进行了更正,之后该元素可见。