1

Here is the error message:

org.openqa.selenium.WebDriverException: unknown error: Element <div class="col-md-2 col-sm-2 hidden-xs days" id="lblday3">...</div> is not clickable at point (799, 308). Other element would receive the click: <div class="modal-body text-center">...</div>
  (Session info: chrome=69.0.3497.100)

Hi everyone, the above exception was thrown in my ThankYou page in my project. I've tried to change the wait time but it also doesn't work. Below is the method I used.

public void Clickthankyou() throws InterruptedException
    {
        if(driver.findElement(By.xpath("//*[@id='id_appoint']/h2")).isDisplayed())
        {

        WebDriverWait wait = new WebDriverWait(driver, 6);  
        WebElement elem =wait.until(ExpectedConditions.elementToBeClickable(Dateselect));

        if(elem.isDisplayed())
        {
            elem.click();
        }

        Thread.sleep(2000);

        driver.findElement(Clickbook).click();
        }
        else
        {
            driver.navigate().back();
        }
Lam Le
  • 1,489
  • 3
  • 14
  • 31
koushick
  • 497
  • 2
  • 8
  • 30
  • It happens when the button is wrapped and sometimes cannot accept the click. You can bypass this by clicking on the wrapper Ex.: span, div ... etc. Or execute js click with driver javascript executor. – Infern0 Oct 15 '18 at 07:01
  • @Infern0 But, We Can use Actions Instead of Js Click.? – koushick Oct 15 '18 at 07:08
  • yes, but from my experience js click is the bulletproof solution for using multiple browsers and/or when some of the drivers ex: firefox/ie have issues with actions class. – Infern0 Oct 15 '18 at 07:11
  • whats inside Dateselect and Clickbook – Ashish Kamble Oct 15 '18 at 07:18
  • @AshishKamble Dateselect is Nothing But List of Dates For a Week Will be Appearing. i Will be Clicking one Random Date. Inside The Date, Booknow Option Will be Available i Will be Clicking on That. – koushick Oct 15 '18 at 07:30

1 Answers1

1

The basic reason of this exception is due to ViewPort of Browser window which is seen by the user. You need to scroll to specific element then click on it.
Key thing is element is not visible so not eligible for clicking. ok use this code for do the fix using JavascriptExecutor ,

JavascriptExecutor js = (JavascriptExecutor) driver; 
js.executeAsyncScript('arguments[0].scrollIntoView(true)', driver.findElement(By.xpath("//*[@id='id_appoint']/h2")))
js.executeAsyncScript('window.scrollBy(0,-150)')

or you can also do same using Actions class.

new Actions(driver).moveToElement(driver.findElement(By.xpath("//*[@id='id_appoint']/h2"))).click().perform();

Possible duplicate of Debugging "Element is not clickable at point" error

Ashish Kamble
  • 2,555
  • 3
  • 21
  • 29