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 returns 2 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 keyword wait until element is visible
still takes 5 seconds to be done, although the log says Element 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?
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.
来源:https://stackoverflow.com/questions/39869543/how-to-reduce-waiting-time-in-selenium2library-robot-framework