Error while locating element | Selenium Training|Java|WebDriver|TestNG|Frameworks|Videos
30% Mid August Discount Avail now

Selenium Training Forum

Error while locating element

Siddharth Rathod Post on 02/07/2019

Getting below error :- 

Starting ChromeDriver 75.0.3770.90 (a6dcaf7e3ec6f70a194cc25e8149475c6590e025-refs/branch-heads/3770@{#1003}) on port 5247
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1562082012.640][WARNING]: Timed out connecting to Chrome, retrying...
Jul 02, 2019 9:10:17 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Exception in thread "main" org.openqa.selenium.ElementNotInteractableException: element not interactable
(Session info: chrome=75.0.3770.100)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'AA-PC', ip: '', 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_211'
Driver info:
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 75.0.3770.100, chrome: {chromedriverVersion: 75.0.3770.90 (a6dcaf7e3ec6f..., userDataDir: C:\Users\aa\AppData\Local\T...}, goog:chromeOptions: {debuggerAddress: localhost:53235}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: f66d36f975279ff02438cc4495b15434
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(
at org.openqa.selenium.remote.HttpCommandExecutor.execute(
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(
at org.openqa.selenium.remote.RemoteWebDriver.execute(
at org.openqa.selenium.remote.RemoteWebElement.execute(
at Execrcise.main(


Code - 

import org.openqa.selenium.By;
import org.openqa.selenium.PageLoadStrategy;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

public class Execrcise {

public static void main(String[] args) {

WebDriver driver=new ChromeDriver();

driver.findElement(By.xpath("//div[@class='header-minicart-ctr header-minicart-slave ag-hide-on-lg']/div/div[2]/a/i")).click();





Support Team Reply on 03/07/2019

The exception you are getting is ElementNotInteractableException this means that the code is able to retrieve the element but is not able to interact with it. This happens when the element is disabled or not visible on the screen.

Siddharth Rathod Reply on 03/07/2019

But this code was written to click on Shopping cart of i.e. the exercise which you gave in the video.

And also I am able to click on that manually.

Can you please check and let me know.

Thanks in advance



Support Team Reply on 05/07/2019

Did you try using Actions class?

If not, please refer to the video again and try using the Actions class method.