-1

Exception in thread "main" org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element ... is not clickable at point (1075, 323). Other element would receive the click: (Session info: chrome=79.0.3945.130)

How to solve this error for selenium webdriver code..FOR CLICKING THE POST BUTTON using xpath the devloperr donot provide id for that button CODE:

WebElement element1=driver.findElement(By.xpath("//*[@id=\"SINPost\"]/button"));
element1.click();
Jakob F
  • 1,046
  • 10
  • 23
vaidehi
  • 11
  • 1
  • 1

1 Answers1

1

If you are using chrome it can happen sometimes, because chrome always tries to click at the middle of the element. What you can do is use JavaScriptExecutor interface of selenium. The code should look like this

JavascriptExecutor js = (JavascriptExecutor) DriverManager.getWebDriver();
js.executeScript("arguments[0].click();", element);
Sumit Bera
  • 36
  • 5
  • Exception in thread "main" java.lang.ClassCastException: java.util.Vector$1 cannot be cast to org.openqa.selenium.JavascriptExecutor at demo.iNetwork_tab.main(iNetwork_tab.java:41) after adding above command I got this error and also it not take .getwebdriver method – vaidehi Feb 12 '20 at 10:52
  • Hey, @vaidehi .getdriver is my custom method which returns me the webdriver. So in place of DriverManager.getWebDriver(); Please pass your webdriver. – Sumit Bera Feb 13 '20 at 07:11
  • this also not working I tried to create custom path but that thing also not working to lalocate the button – vaidehi Feb 17 '20 at 07:24
  • the element will not locate error continuously arrived, the button inspect only div id, class and button one click gave .. – vaidehi Feb 26 '20 at 12:04
  • I tried it by XPath, custom XPath, using javascript executor CSS locator by all ways it cant works – vaidehi Feb 26 '20 at 12:06
  • @vaidehi If nothing is working, Can you talk to your developers to provide you some Id or any other suitable locator. Because xpath can be of no use many times – Sumit Bera Mar 09 '20 at 05:10