我正在执行的硒网络测试有问题。单击并转到下一页后,我不断收到过时的元素引用错误(这是正确的)
WebDriver driver = DriverFactory.getWebDriver()
WebElement PositionTable = driver.findElement(By.xpath('//td[2]/table/tbody/tr/td/table'))
List<WebElement> Rows = PositionTable.findElements(By.tagName('tr'))
println('No. of rows: ' + Rows.size())
table: for (int i = 0; i < Rows.size(); i++) {
List<WebElement> Cols = Rows.get(i).findElements(By.tagName('td'))
for (int j = 0; j < Cols.size(); j++) {
if (Cols.get(j).getText().equalsIgnoreCase(ExpectedPosition)) {
Cols.get(j).findElement(By.tagName('a')).click()
WebUI.delay(5)
table: break
}
}
}