Robot Framework: Wait Until Element Is Visible vs. Element Should Be Visible, which one is better to use?

10,815

Yes, factually both of them can be used to validate if an element appears on the page but ofcoarse you can design your tests for a much better performance.

Ideally, the Waits should be implemented strictly as per your Usecase and Test Steps.

  • Using Wait Until Element Is Visible: If your usecase involves visibility of all the 20 elements, albeit Wait Until Element Is Visible is the best fit.

  • Using Wait Until Element Is Visible for header text AND then use Element Should Be Visible: If your usecase involves visibility of any element, inducing Wait Until Element Is Visible for header text would be a complete overhead. As you have no validation with the header text, this step isn't necessary. Rather you should directly induce Wait for the visibility of the desired element(s).

Share:
10,815
jeffsia
Author by

jeffsia

Updated on June 17, 2022

Comments

  • jeffsia
    jeffsia almost 2 years

    I know that both of them can be used to validate if an element appears on the page but I was wondering about the performance impact and readability implications of each. So my question is, suppose you have 20 elements to check in the page,

    1. Is it better to use Wait Until Element Is Visible for all 20 elements?

    OR

    1. Use Wait Until Element Is Visible for one element (for example, a header text) to let my automation script know that the page has loaded AND then use Element Should Be Visible for the rest (e.g. form fields)?