I\'m working with gecko driver selenium java with FF 60.0. Previously my code was working properly, but all of sudden, now every time I run it, it gives me an error as
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']")));
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.
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:
@Test
.You can simply try following js to scroll the page.Enter Pixel asper your requirement to scroll page. Here I use 3000 Px to scroll page to mid
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("window.scrollBy(0,3000)");