Proper use of Wait Until Keyword Succeeds

Does anyone use this keyword for the below stated purpose and find it a good solution? Any other suggestions are appreciated.

When clicking on a grid to open a form, I have replaced the use of “Sleep” and “Wait Until Element is Visible” with "Wait Until Keyword Succeeds ". This appears to have reduced the number of failed tests where “StaleElementReferenceException” or “ElementClickInterceptedException” errors are thrown.

I also use “Set Selenium Implicit Wait” to 3s at the test level and timeout = 8 at the global level.

Example:
Wait Until Keyword Succeeds 1 1 sec click element //*[@id=“gridContainer”]/div/div[6]/div/table/tbody/tr[1]/td[1]/div

Hi @bweston,

I guess there is no reason not to do it that way if it works reliably for you.

As it appears you’re using SeleniumLibrray? I would have used Wait Until Element Is Visible first and then simply followed it with a click. Something like this:

    Wait Until Element Is Visible    //*[@id=“gridContainer”]/div/div[6]/div/table/tbody/tr[1]/td[1]/div
    click element    //*[@id=“gridContainer”]/div/div[6]/div/table/tbody/tr[1]/td[1]/div

Doing it your way will probably end up with many screenshots, 1 for each failed click, these screen shots might be useful? but they might also be an undesirable consumption of disk space, especially if you run CI builds.

Dave.

The issue I was having using “Wait Until Element is Visible” is that I was getting too many timeouts. So when I set the arguments to retry 1 sec and retry interval 1, I only get one screenshot when fails

Hi @bweston,

Maybe you need to wait the the page finishes loading before using Wait Until Element is Visible? I’ve never needed to do that before but who knows.

Here is an example of waiting for the javascript to finish running on a page before continuing, I’d be curious if that solved the timeouts or not.

Dave.