java - Selenium Webdriver. Error 'org.openqa.selenium.StaleElementReferenceException: Element is no longer valid' -
selenium webdriver + java. code: public list<userdata> getusers() { list<userdata> users = new arraylist<userdata>(); webelement userlist = driver.findelement(by.id("users")); iselementdisplayed(by.xpath("//table[@id='users']/*/tr[position() > 1]"), 10); list<webelement> tablerows = driver.findelements(by.xpath("//table[@id='users']/*/tr[position() > 1]")); (webelement tablerow : tablerows) { list<webelement> cells = tablerow.findelements(by.tagname("td")); userdata user = new userdata(); user.fio = cells.get(2).gettext(); user.login = cells.get(3).gettext(); user.rank = cells.get(4).gettext(); user.cabinet = cells.get(5).gettext(); users.add(user); } return users; } after delete user table, method throws: org.openqa.selenium....