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..:)
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.
Richard's answer was very helpful but might not have been directly applicable for everyone. I had to customize it to my use case -
Wait Until Keyword Succeeds 5x 10s Click Element XPATH://<add xpath>
This would run the test 5 times with a 10s interval in between failures absolutely removing the need for any explicit sleeps to be made in the code. Both the values can be altered to suit you needs better. Note that the Wait Until Keyword Succeeds
keyword can be used along with any operation including Input Text
which means that if you change every line of your test case to use this, you can guarantee that your tests will pass irrespective of variations in response times of the website.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With