我正在尝试在selenium
. 进入子页面,获取数据,返回,进入下一个子页面......不幸的是,exception
我出现了
“org.openqa.selenium.StaleElementReferenceException:元素不再有效”
好吧 - 重新加载后它是另一个页面。有任何想法吗?
代码:
List<WebElement> rows = driver.findElements(By.className("detail-card__heading"));
List<WebElement> cols=new ArrayList<WebElement>();
for(int i=0;i<rows.size();i++){
System.out.println("Nr oferty: "+i);
cols=rows.get(i).findElements(By.tagName("div"));
for(WebElement col:cols) {
System.out.print("cell value "+col.getText());
col.click();
}
driver.get(CurrentUrl);
}