4

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?

enter image description here

Zeinab Abbasimazar
  • 9,835
  • 23
  • 82
  • 131

1 Answers1

3

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:

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

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

Mukesh Takhtani
  • 852
  • 5
  • 15
  • I looked at the Robot Framework documentation related to logging. Per documentation - "By default messages logged via the standard output or error streams get their timestamps when the executed keyword ends. This means that the timestamps are not accurate and debugging problems especially with longer running keywords can be problematic...." Refer the link - http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#logging-information – Mukesh Takhtani Oct 16 '16 at 18:45