selenium-webdriverrobotframeworkselenium-ide

Selenium : ElementClickInterceptedException Element is not clickable


I'm using RED (Robot framework editor) currently working on a project and when trying to click on an href I get an error

ElementClickInterceptedException, element is not clickable at point(616,304). Other element would receive the click : <div class="navigation-bar">...

Code

Wait Until Keyword Succeeds 4x 5s Wait Until Element is Enabled ${button_locator}
Click Element ${button_locator}`

HTML

<a href="#" role="button" class="rs-nav-item">
    <div class="segment-control-item-cat divider-text active">BUTTON</div>
    <span class="rs-ripple-pond">..</span>
</div>

The XPath I'm using for ${button_locator} is:

//*[@id="root"]/section[2]/div/div[1]/div[2]/div[2]/a[1]

(planning to shorten it later on)

I have tried adding sleep timers, tried scroll into view function, etc. but no results sadly.


Solution

  • When you get an ElementClickInterceptedException, that means that you are trying to click one element but another element is overlapping it and receives the click. This is described in the error message.

    Other element would receive the click : <div class="navigation-bar">...
    

    Without access to the page, basically all we can do is guess or give general advice. You need to find the

    <div class="navigation-bar">
    

    element and do one of a few things:

    1. Since the class on the DIV is "navigation-bar", it might be a floating navigation element, e.g. top nav, left nav, etc. If you can, scroll the desired element out from beneath the nav element. You might need to scroll up or scroll down, depending on where the element is.

    2. The blocking element might be a popup dialog or some other permanent block. In that case, you'd need to find a close or dismiss button and click it.

    3. The blocking element might be a temporary dialog like a Loading... banner, etc. In that case you can wait for the banner to appear and then wait for it to disappear... then click your element.

    4. If none of these work, you can always just use JS to click the element. Selenium is intended to be used to simulate user behavior so it clicks an element like a user would ... from the top down. That's partially why you are running into this issue. If you aren't trying to simulate an actual user interacting with your page, JS can get the job done.

      ${ele}    Get WebElement    //*[text()='Logout']
      Execute Javascript    arguments[0].click();     ARGUMENTS    ${ele} 
      

      See the docs for more info.