I'm using ChromeDriver in Groovy, for clarification.
I know that you usually can get a Stale Element Exception if you save an element, the page changes and then you try to access it. But my problem is that I sometimes at random get that error when i literraly just obtained it.
My code looks something like this:
def elem = new WebDriverWait(driver, timeout).until(ExpectedConditions.elementToBeClickable(By.xpath(xpath)))
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", elem)
elem.click()
And it's on the elem.click() that I get the exception, which makes no sense to me.