Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Robot selenium2library how to set wait for elements globally

I would like to ask whether there is an option in robot (using selenium2library) to set some implicit wait for ALL elements which should be located during the test on just one place? Currently I place the wait before EACH element in my keywords (which does not look so nice)

Wait Until Element Is Visible    ${repeated for each element}

The frontend is made in Angular. I found that it might be the cause of the troubles and I also found some extended selenium2library, BUT I cannot use this extended library, because I can use only officially supported library (which is now just selenium2library)...

I also tried to set the implcit wait and timeout while importing the Library, but it seems it does not help (if I comment my "waits" before each element, it starts failing again)

Library    Selenium2Library    10    15

Any suggestion? Do I really have to put the wait before each element in this case?

Thank you

like image 235
neliCZka Avatar asked Oct 29 '22 16:10

neliCZka


People also ask

How do I set the wait time in Robot Framework?

Wait Until Location Is – Waits until the current URL is expected. Wait Until Location Is Not – Waits until the current URL is not location. Wait Until Location Contains – Waits until the current URL contains expected. Wait Until Location Does Not Contain – Waits until the current URL does not contain the location.

How do you set the implicit wait in Robot Framework?

Implicit wait specifies the maximum time how long Selenium waits when searching for elements. It can be set by using the Set Selenium Implicit Wait keyword or with the implicit_wait argument when importing the library.

What is the difference between SeleniumLibrary and Selenium2Library?

Nowadays Selenium2Library is just a thin wrapper to SeleniumLibrary that eases with transitioning to the new project. See SeleniumLibrary and Selenium2Library project pages for more information. Selenium2Library is a web testing library for Robot Framework.

How do you write if condition in Robot Framework?

END Use Run Keyword If in Robot Framework Run Keyword If ${True} Log This line IS executed. Run Keyword If ${False} Log This line is NOT executed. Use Run Keyword Unless in Robot Framework Run Keyword Unless ${True} Log This line is NOT executed. Run Keyword Unless ${False} Log This line IS executed.


1 Answers

I don't know if there's a better approach, but you can try slowing down Selenium with Set Selenium Speed:

Set Selenium Speed  0.5 seconds

http://robotframework.org/Selenium2Library/Selenium2Library.html#Set%20Selenium%20Speed

like image 103
Thiago Curvelo Avatar answered Nov 04 '22 08:11

Thiago Curvelo