Problems:
Waiting for elements to be clickable is always a challenging obstacle to write automated test class. Especially when you want to click on an element that is covered by another layer or not clickable at some periods of time. You may wonder what if we try to click element again and again until somethings happen?
Solutions:
A retry click function which gives you the ability to click element again until an expected condition is met.the
It will check if element is clickable.
If that element is clickable, it will perform click action.
Then, it waits for an expected condition to be successful with timeout is 2 seconds.
After the timeout, if any exception occurs (ex: NotFound,..), it will perform click action again and then wait again.
Example of retryClick() function written in Java:
Pros:
Very useful in many cases that element is covered or not clickable at some points of time.
Flexible in passed in expected conditions.
Easily to modify the timeout of waiting for an element.