How to reduce waiting time in Selenium2Library Robot Framework
The Wait Until ...
keywords in Selenium2Library have an optional argument for specifying the explicit timeout
.
E.g.
Wait Until Element Is Enabled | locator | timeout=2
The timeout
in Wait Until ...
keywords is can also be set using below ways:
- When importing the
Selenium2Library
, we can set the value of timeout (default being 5 seconds) argument as-Library | Selenium2Library | 2
Refer the documentation on Importing
.
- If there's a need to override the timeout (set during importing library), then we use the keyword
Set Selenium Timeout
.
Refer the documentation on Set Selenium Timeout
Finally, to understand the difference between Explicit Wait and Implicit Wait, please refer this documentation.
Hope this was helpful.
Zeinab Abbasimazar
Looking to attain a challenging and responsible position as a software engineer and software analyst in telecommunication and software industry which effectively utilizes my personal, professional and educational skills and experiences. I’m also looking forward to learn and experience more on big data concepts/solutions.
Updated on June 07, 2022Comments
-
Zeinab Abbasimazar almost 2 years
I have a test script in Robot Framework which I want to reduce its elapsed time. I have below command as a part of the test procedure:
wait until element is enabled id=${elementId}
In run time, it takes about 5 seconds to be done; I've set selenium implicit wait to 2 seconds using below line at the beginning of the test:
set selenium implicit wait 2 seconds
I get the applied selenium implicit wait afterwards with
get selenium implicit wait
and it returns2 seconds
, but the first command still takes about 5 seconds to complete. What should I do to reduce this time??Any help or suggestion will be appreciated.
I tried
set selenium timeout 2
, but the keywordwait until element is visible
still takes 5 seconds to be done, although the log saysElement locator 'id=ZiZi' did not match any elements after 2 seconds
. The image shows the log in details. Why there is a difference between timeout seconds and elapsed time?