How To Set Page Load Timeout Or Something Similar

350 views
Skip to first unread message

Ricardo Maximino

unread,
Sep 23, 2021, 7:45:40 PM9/23/21
to robotframework-users

I am trying to find a way to set the page load timeout or something similar.

In Python it looks like this:

driver = webdriver.Chrome(r'C:\Users\webdrivers\chromedriver.exe') driver.set_page_load_timeout(1)

I found the [Timeout] that works well but, I can not catch the error and it resumes the execution.

 

I would like to write something like that:

 

*** Keywords ***

Load Page

    [Arguments]                                 ${url}

    Set Selenium Page Load Timeout              20 seconds

    Open Available Browser                      ${url}

    Log To Console               

    …   The url: ${url} Succeeded to load

    [Teardown]     Log If Fails     ${url}

 

*** Keywords ***

Log If Fails

    [Arguments]     ${url}

    IF    '${KEYWORD_STATUS}' == 'FAIL'

    Log To Console     The url: ${url} Failed to load

    END

 

*** Tasks ***

    @{list}=                       Create List          

    …    http://localhost:8011/timeout/10     

    …    http://localhost:8011/timeout/30

   …    http://localhost:8011/timeout/10

    FOR    ${url}    IN   @{list}

         Run Keyword And Continue On Failure     Load Page     ${url}

    END

    Log To Console

    …    The task finish the execution

    [Teardown]    Close All Browsers

 

And I expect to see printed in the console:

 

The url: http://localhost:8011/timeout/10 Succeeded to load

The url: http://localhost:8011/timeout/30 Failed to load

The url: http://localhost:8011/timeout/10 Succeeded to load

The task finish the execution

 

Is there any solution or workaround for that?

 

Thanks in advance!!

Dave Amies

unread,
Sep 25, 2021, 12:36:16 AM9/25/21
to robotframework-users
Hi Ricardo,

Also have a read of Timeout to understand what those two options affect.

Hope that helps,

Dave.
Reply all
Reply to author
Forward
0 new messages