[自动化测试]Stale Element Reference Exception




关于这个异常,官方给出两个可能原因:

The element has been deleted entirely.The element is no longer attached to the DOM.我的个人理解是,无论是否借助框架,实际上的操作都是先找到这个element,然后对它进行操作(一般就是点击),在这两个动作之前,如果JavaScript把网页给刷新了,那么操作的时候就会碰到Stale Element Reference Exception。所以这个异常并不是每次都会产生,也不是你想复现就能复现。

我自己写的代码 多获取几次这个元素

web-异常:Stale Element Reference Exception_自动化测试