I have a button I'm trying to click that's offscreen. I tried to run the following code to click it.
//...
//FluentWait wait initialized prior to this
WebElement edit = wait.until((d) -> d.findElement(By.cssSelector(".editBtn")));
Actions builder = new Actions(driver);
builder.moveToElement(edit).click().build().perform();
but I get a MoveTargetOutOfBoundsException.
I've seen some other answers and they suggest executing Javascript that would scroll the page to bring the element into view. But what if it's not known how far you'd need to scroll to reach the element? Is there any other way to reach out of view elements or is executing Javascript the standard way?