org.openqa.selenium.ElementNotInteractableException: Element <a class="bg-inverse "> could not be scrolled into view when trying to click a button
This error message...
Exception in thread "main" org.openqa.selenium.ElementNotInteractableException: Element <a class="bg-inverse text-white dropdown-item" href="/admin/worker-summary"> could not be scrolled into view
...implies that the GeckoDriver / FirefoxDriver was unable to interact with the desired element.
Solution
Once you locate the element btnWorkerSummary moving ahead as you are invoking click()
instead of ExpectedConditions as visibilityOf
you need to use elementToBeClickable()
as follows:
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//a[@href='/admin/worker-summary']"))).click();
However, another issue is the incompatibility between the version of the binaries you are using as follows:
- Your Selenium Client version is 3.12.0.
- Your JDK version is 1.8.0_51 which is ancient.
Solution
- Upgrade JDK to recent levels JDK 8u201.
- Execute your
@Test
.
Try to use javascriptexecutor as shown sample code below,
JavascriptExecutor je = (JavascriptExecutor) driver;
je.executeScript("arguments[0].scrollIntoView(true);",driver.findElement(By.xpath("//a[@href='/admin/worker-summary']")));