Generalize a keyword to all tests

Hi everyone,

In my tests, I often meet a “loading”, that obscures next interactions with my WebElements, so I used Wait Element Is Not Visble" when I met it.

The problem is that I can predict when this “loading” could come, it’s unpredictable.

So I want to use “Wait Element Is Not Visble” as I did but by a global way, is it possible with RF?

Thank you so much

From the keyword Wait Element Is Not Visible I’m guessing you are using Selenium Library?

So there are a couple of things you could do:

  1. increase Set Selenium Implicit Wait then you might not need to wait for “loading” to disappear
  2. before your action keyword (click, input text, etc) instead of Wait Element Is Not Visible, use Wait Element Is Visible and/or Wait Element Is Enabled on the element you are about to interact with, I expect when the “loading” is visible, it’s a html element floating above the other elements in the page making the element you want to interact with either hidden or disabled.

The problem with using Wait Element Is Not Visible everywhere is what you set your timeout to and the impact it will have on your test execution times, if you set it too low then the “loading” element might still be on the screen, if you set it high and the “loading” element never appeared then you have to wait till timeout till you can progress.

Another option would be to create a wait for finish loading keyword, have it first check if the “loading” element is visible before waiting for it to be not visible, this could potentially be used in a test Test setup or teardown depending on how your tests are structured

Hopefully i’ve given you some useful options,