0

I am not able to click element after storing the webelements in the List collection.

 List<WebElement> links = driver.findElements(By.xpath("//ul[@class='dropdown-menu']/li/a"));
        System.out.println(links.size());
        for (int i = 0; i < links.size(); i++) {
            String text = links.get(i).getText();
            System.out.println(text);
            if (text.contentEquals("CSS")) {
                links.get(i).click();
                break;
            }
        }

I used action class to find the drop down menu and the drop down is developed in bootstrap. Below mentioned full error:

Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (183, 560)
  (Session info: chrome=63.0.3239.132)
  (Driver info: chromedriver=2.28.455520 (cc17746adff54984afff480136733114c6b3704b),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 71 milliseconds
Build info: version: 'unknown', revision: '5234b32', time: '2017-03-10 09:00:17 -0800'
System info: host: 'RAV-LAP-503', ip: '192.168.2.55', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.28.455520 (cc17746adff54984afff480136733114c6b3704b), userDataDir=C:\Users\SAJITH~1.KUM\AppData\Local\Temp\scoped_dir13096_30556}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=63.0.3239.132, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]
Session ID: 697295b27acff024727ad8efd7d66c14
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
 at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)
 at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)
 at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:638)
 at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:274)
 at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84)
 at Yahoo.bootstrap.main(bootstrap.java:30)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498)
 at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
user3404922
  • 5
  • 1
  • 2
  • My guess would be that because the drop-down menu is not first clicked, the list elements are not exposed, therefore the error message that they are not clickable. Without seeing the HTML code, I can't be sure. Is it a select element? – Bill Hileman Jan 10 '18 at 19:39

1 Answers1

0

As you see the error as :

org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (183, 560) 

I have pointed you towards the solution as in Selenium Web Driver & Java. Element is not clickable at point (36, 72). Other element would receive the click

But your main issue is the version compatibility among the binaries you are using as follows :

Various updates to work with Chrome 57+

  • You are using chrome=63.0.3239.132
  • To work with chrome=63.x you have to use ChromeDriver 2.34 as the Release Notes of ChromeDriver 2.34 clearly mentions :

Supports Chrome v61-63


Solution

  • Upgrade ChromeDriver to ChromeDriver v2.34.
  • Downgrade Chrome to Chrome v57.x level.
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352