ElementNotInteractableException: Element could not be scrolled into view

132 views
Skip to first unread message

Earl Harris

unread,
Jul 10, 2023, 4:55:09 PM7/10/23
to Selenium Users

When I run this program ...

package pack1;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class MyClass4 {

public static void main(String[] args) {
String baseUrl = "http://demo.guru99.com/test/block.html";
WebDriver driver = new FirefoxDriver(); // new ChromeDriver();

driver.get(baseUrl);
driver.findElement(By.partialLinkText("Outside")).click();
System.out.println(driver.getTitle());
driver.quit();
}
}

The browser doesn't close and the program throws this exception.

[AsyncHttpClient-1-2] DEBUG org.asynchttpclient.netty.channel.ChannelManager - Adding key: http://localhost:4714 for channel [id: 0x67644e4a, L:/127.0.0.1:62605 - R:localhost/127.0.0.1:4714]

Exception in thread "main" org.openqa.selenium.ElementNotInteractableException: Element <a href="http://www.fb.com"> could not be scrolled into view

Build info: version: '4.10.0', revision: 'c14d967899'

System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '13.4.1', java.version: '17.0.4.1'

Driver info: org.openqa.selenium.firefox.FirefoxDriver

Command: [36adc73a-afd4-4f54-9f7a-72526ce9cd04, clickElement {id=e12da93f-28fd-46ea-8c05-fe3f2843e2d5}]

Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 114.0.2, moz:accessibilityChecks: false, moz:buildID: 20230619081400, moz:debuggerAddress: 127.0.0.1:32788, moz:geckodriverVersion: 0.33.0, moz:headless: false, moz:platformVersion: 22.5.0, moz:processID: 7383, moz:profile: /var/folders/fd/f8p8pgpn2lj..., moz:shutdownTimeout: 60000, moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, moz:windowless: false, pageLoadStrategy: normal, platformName: mac, proxy: Proxy(), se:cdp: ws://127.0.0.1:32788/devtoo..., se:cdpVersion: 85.0, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}

Element: [[FirefoxDriver: firefox on mac (36adc73a-afd4-4f54-9f7a-72526ce9cd04)] -> partial link text: Outside]

Session ID: 36adc73a-afd4-4f54-9f7a-72526ce9cd04

at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)

at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)

at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)

at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:199)

at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:132)

at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:51)

at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:191)

at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:196)

at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:171)

at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:531)

at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:242)

at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:77)

at pack1.MyClass4.main(MyClass4.java:15)

I tried putting in a timer, but this didn't fix the problem. There really isn't much scrolling needed on this page.

This class is in a Maven project with the following POM.


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>org.earl</groupId>

<artifactId>SampleProjectView3</artifactId>

<version>0.0.1-SNAPSHOT</version>

<properties>

<java.version>17</java.version>

<slf4j.version>2.0.7</slf4j.version>

</properties>

<dependencies>

<dependency>

<groupId>org.seleniumhq.selenium</groupId>

<artifactId>selenium-java</artifactId>

<version>4.10.0</version>

</dependency>

<dependency>

<groupId>org.seleniumhq.selenium</groupId>

<artifactId>selenium-http-jdk-client</artifactId>

<version>4.10.0</version>

</dependency>

<dependency>

<groupId>org.slf4j</groupId>

<artifactId>slf4j-api</artifactId>

<version>${slf4j.version}</version>

</dependency>

<dependency>

<groupId>org.slf4j</groupId>

<artifactId>slf4j-simple</artifactId>

<version>${slf4j.version}</version>

</dependency>

</dependencies>

</project>

I'm using the geckodriver from this site.

https://github.com/mozilla/geckodriver/releases

I selected geckodriver-v0.33.0-macos.tar.gz, because I am running on a Macbook Air.

I put the driver in the outermost project folder.


Reply all
Reply to author
Forward
0 new messages