【发布时间】:2018-04-30 23:00:48
【问题描述】:
我不知道为什么会出现这个错误。需要帮助来修复它。我正在开发的网站:“http://freevideolectures.com/Course/3680/Pentaho-BI”。在本站
List<WebElement> cl = d.findElements(By.xpath("//ul[@class='lecture_menu']/li/a"));
System.out.println(cl.size());
for(int e=0 ; e<=cl.size()-1; e++) {
cl.get(e).click();// i think the error shows up here, the loop runs for e=0 ,
Thread.sleep(1000);
String q = d.findElement(By.xpath(".//*[@id='cs-about']/div/div[2]/div[2]/span/a")).getAttribute("href");
System.out.println(q);
}
循环为 e=0 运行一次,我得到了它的输出。在此之后出现错误。错误:过时的元素引用:元素未附加到页面文档。请帮忙 。
【问题讨论】:
-
你的输出是什么?
-
System.out.println(q);输出:keepvid.com/?url=http://www.youtube.com/watch?v=YZz8tphl9o4@johnll
-
如何处理StaleElement? ,我在 PageFactory 中阅读了 StaleElementReference 异常,我没有得到它。 @DebanjanB
-
您能总结一下您尝试自动化的手动步骤吗?
标签: java selenium automation staleelementreferenceexception