Unable to click on WebElement

"Element is not clickable at point (1181, 0.5666656494140625). Other element would receive the click: Command duration or timeout: 109 milliseconds"

I am getting this Message when i execute my script Here is my WebElement:

<a class="btn btn-circle show-tooltip" href="/MCare_Test/Auhmc/AdminPayer/Add" title="" data-original-title="Add new record">
  <i class="fa fa-plus"/>
</a>

Answers


Difficult to say without seeing the page you want to remote-control and the Selenium locator of the element you want the WebDriver to click.

But this sounds like there's some overlay element on your page that pops up on mouseover while the mouse cursor is moving from the current element to the element you want to click. I had a similar issue, where I found a workaround, but it's quite dirty: How to avoid MouseOver on Selenium Click()

If it's not a popup you're dealing with, you can try my solution anyway. In that case, you can probably omit the element.SendKeys(Keys.Escape);. But the MoveToElement() might be useful for you.


Looks like element you are trying to click on which is not visible. You need to wait for the element to be visible and then perform click operation.

WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(60));
IWebElement element = wait.Until<IWebElement>((d) => { return driver.FindElement(By.CssSelector("a[data-original-title='Add new record']")); });
        element.Click();

If this doesn't work, please share your complete HTML code.


If your problem is that the element is scrolled off the screen (and as a result under something like a header bar), you can try scrolling it back into view like this:

private void scrollToElementAndClick(WebElement element) {
    int yScrollPosition = element.getLocation().getY();
    js.executeScript("window.scroll(0, " + yScrollPosition + ");");
    element.click();
}

if you need you could also add in a static offset (if for example you have a page header that is 200px high and always displayed):

    public static final int HEADER_OFFSET = 200;

    private void scrollToElementAndClick(WebElement element) {
    int yScrollPosition = element.getLocation().getY() - HEADER-OFFSET;
    js.executeScript("window.scroll(0, " + yScrollPosition + ");");
    element.click();
}

If still not work then use JavascriptExecutor. But it is not recommended

WebElement element= driver.findElement(By.xpath("Your Locator"));

JavascriptExecutor executor = (JavascriptExecutor) driver;
executor.executeScript("arguments[0].click();", element);

Hope it will help you :)


It may be due to element is not visible to your driver. I would suggest you to apply

Thread.sleep(10000);

So, the element will be visible and driver will perform expected operation.


Thread.sleep(6000);

due to page load Click() method unable to click on WebElement but i worked out using sleep() sleep method


Need Your Help

Generic C++ multidimensional iterators

c++ algorithm multidimensional-array iterator

In my current project I am dealing with a multidimensional datastructure.

Address in PHP variable, Google Maps embedding without Javascript?

php google-maps geocoding

I consider myself to be an average PHP coder, but I can barely edit the few bits of JavaScript code that I need on my websites. I have an address in a PHP variable and I would like a simple map to ...