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 に答える