I have a StaleElementReferenceException.
I found How to avoid "StaleElementReferenceException" in Selenium?. I tried to understand and fit it to my code.
By ordersBy = (By.id("subtab-AdminParentOrders"));
WebElement orders = driver.findElement(ordersBy);
orders.click();
public boolean retryingFindClick () {
boolean result = false;
int attempts = 0;
while (attempts < 2) {
try {
driver.findElement(By.id("subtab-AdminParentOrders")).click();
result = true;
break;
} catch (StaleElementReferenceException e) {
}
attempts++;
}
return result;
}
First compilation error. What should I paste as argument? Why is a semicolon expected?
I wrote this method in main. Maybe that is why return is denied. How can I adapt this method to my code (in main)?