Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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)?
like image 680
jeffsia Avatar asked Nov 05 '18 09:11

jeffsia


1 Answers

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).

like image 170
undetected Selenium Avatar answered Nov 15 '22 12:11

undetected Selenium