I have a scenario as outlined in the screenshot below:
So, I've built some code which will allow me to click on the bar charts on the left....each time I do it will display a relational bar chart on the right. If the bar chart is particularly big on the left it might take a while for the relational bar chart on the right to show. To counter this, I built a fluentWait method, as below:
public static void fluentWaitOnRelationalBarChartSelector(InternetExplorerDriver driver)
{
WebElement relationalBarSelect = (new WebDriverWait(driver, 20))
.until(ExpectedConditions.elementToBeClickable(By.tagName("rect")));
relationalBarSelect.click();
}
However, not always, but sometimes, I am getting an error in the console as below:
Exception in thread "main" org.openqa.selenium.StaleElementReferenceException: Element is no longer valid
(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 33 milliseconds
What I'm not sure on is why this timeout is occurring after 33 milliseconds when I have applied a wait of 20 seconds? Is there a way of me being able to cater for this StaleElementReferenceException
?
Any help would be appreciated.