seleniumxpathautomated-testsrobotframeworkselenium2library

Element is not clickable at point - but it clicks in fact


My test is failing with:

WebDriverException: Message: unknown error: Element is not clickable at point (1 786, 183). Other element would receive the click: <'div align="right">...<'/div>

xpath I access is:

${UPDATE}    xpath=//button[@type='submit' and contains(text(),'Update')]

use in keyword:

    wait until element is visible   ${UPDATE}
    click element    ${UPDATE}

source:

<div align="right">
    <button type="submit" class="btn btn-primary ng-binding" ng-click="submitForm()" ng-disabled="updateDisabled">Update</button>
    <button type="button" class="btn btn-primary" ng-click="reset(projectForm)" ng-disabled="updateDisabled">Reset</button>
</div>

But the button is really clicked in the test -> data are saved - so it is OK. I just don't understand why it throws the exception when it clicked correctly and what can I do to make it pass..It is just obvious that it found the element and clicked on it...I also tried to use "wait until element is enabled" and "focus"... Thanks for any suggestion! PS: I added the character "'" to div element in exception, otherwise it was not displayed here..:)


Solution

  • Although it is really bad practise to do this, I would recommend placing a couple of Sleep 1s keywords around your test case, for example:

    Sleep    1s
    Wait Until Element Is Visible   ${UPDATE}
    Sleep    1s
    Click Element    ${UPDATE}
    Sleep    1s
    

    Just to debug and make sure the driver isn't tripping over itself. (Which was the issue I was having) If this then works and passes, you will then need to basically wait longer than the button being active. Is there another section of the webpage which takes longer to load? If so use that.

    But when you can, get rid of the Sleep 1s Key words as it is really bad practise.