Home > Running a Script > Handling Errors & Logging > Handling Page Timeout Error

Handling Page Timeout Error

This error message can happen at a UsePage execution or at a StartBrowser execution.


If the page with a title as specified in UsePage is found but cannot be fully loaded within the default timeout period of 30 seconds, the function reports a Page timeout error. 

This timeout can be increased via the #ActionTimeout system variable. The #ActionTimeout variable can be increased just before the UsePage function and then restored to it's original value immediately following it.

On some web pages, the "Page Loaded" status is never rendered and so UsePage fails, use #PageSynchroLevel=1 for this case.


StartBrowser function executes an automatic synchronization that waits for the target web page to completely load before executing next line. But if a pop-up Security window or Certificate window or Login window is displayed, the target web page cannot be fully loaded unless the pop-up window is dismissed. This leads to a cyclic dependency where the script cannot dismiss the pop-up window until the StartBrowser function completes, but the function cannot complete until the pop-up window is dismissed.

The solution to this problem is to avoid the web page synchronization of the StartBrowser function by using the Shell function. The Shell function waits for the browser to load, but is not dependent upon the web page to load before it returns. Additional script lines can then be used to process the security or pop-up window.

In Recording mode, in order to generate a Shell instead of a StartBrowser, check A new window prompts for a userid and password in Start a website screen.

Or you can write directly the code, the techniques in the following script can be adapted for your specific application.

' Define the Internet Explorer executable and web page as string variables.
    ie_exe$="C:\Program Files(x86)\Internet Explorer\iexplore.exe"

' If a Logon window is displayed before the web page opens, define the Userid and Password as string variables.

' This statement times out if a Security or pop-up window is displayed.
    'Startbrowser("IE", url$)

' Use the Shell statement to start Internet Explorer specifying the web page as the command line argument.
    Shell(chr$(34)+ie_exe$+chr$(34)+" "+url$)

' The following code clicks the Yes button on a Security Alert window to close it.
    UseWindow("IEXPLORE.EXE|#32770|Security Alert", 1)
    Click(Button, "&Yes")

' The following code enters a User ID and Password into a logon web page and submits them for verification. The page is closed if verified.
    UsePage("My Logon Page")
    WriteHTML("INPUT TEXT[NAME= 'my_id']", user_id$)
    WriteHTML("INPUT PASSWORD[NAME= 'password']", passwd$)
    ClickHTMLElement("A[HREF= 'javascript:CheckIdentity']")

Recording mode should be used to generate the blocks of code needed to dismiss the security or pop-up window specific to your application. See Adding Functionality to Existing Scripts for tips on how to generate the code.
See also

Error Handling Overview
Handling Unexpected Windows
Handling Object not found Error
Handling Inacurrate ClickHTMLElement
Handling Incorrect Typing
Handling Pause Error
Logging Execution