元素 IsDisplayed false 但 IsEnabled 为真

Element IsDisplayed false but IsEnabled true

由于某些控件从普通 html 文本输入字段更改为 kendo 文本数字输入字段,我的自动化测试已中断。现在我得到异常“元素当前不可见,因此可能无法与交互”。真正让我感到困惑的是,Webdriver 可以看到这些控件已启用,但它也认为控件未显示。这可能是什么原因?有人有问题吗? 我当前的 webdriver 版本是 2.44.0

任何帮助将不胜感激。


ElementNotVisibleException 的定义:

Thrown to indicate that although an element is present on the DOM, it is not visible, and so is not able to be interacted with.


根据 HTML 代码片段,displaynone属性:style="display: none;"。这意味着该元素存在于 DOM 但在网页中不可见。

因此,ElementNotVisibleException 一定会出现,导致语句:Element is not currently visible and so may not be interacted with.