0

我使用以下代码单击链接数

Thread.sleep(5000);
System.out.println("Click on "+ linkelement.get(i).getAttribute("href"));
driver.navigate().to(Filtered_links[i]);
Thread.sleep(5000);
driver.switchTo().window(homeWindow);

但是,我thread.sleep()在页面更改的任何地方都使用了方法,但仍然出现以下错误:

Exception in thread "main" org.openqa.selenium.StaleElementReferenceException: 
Element not found in the cache - perhaps the page has changed since it `enter code  
here`was looked up 

任何人都知道为什么......!:(

4

1 回答 1

0

找到了上面的解决方案

需要去掉"System.out.println("点击"+linkelement.get(i).getAttribute("href"));" 代码中的声明及其工作正常。

于 2013-10-17T08:53:42.023 回答