stale element reference: element is not attached to the page document

我的环境是:selenium+java+maven

出现这个问题:stale element reference: element is not attached to the page document。

目前总结的原因:

  前一个页面或者某个弹窗没有完全关闭

    添加下面代码解决:

    1、等待页面消失

    WebDriverWait waitscs = new WebDriverWait(driver,60);

    waitscs.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath("//div[@id='ext-comp-1098']")));

    2、线程等待  Thread.sleep(2000);

posted @ 2019-07-01 18:11  linker-yy  阅读(591)  评论(0编辑  收藏  举报