Home > Running a Script > Handling Errors & Logging > Handling Object not found Error > Page Not Found

Page Not Found

The UsePage function provides synchronization within the script, temporarily blocking script execution until the web page with the title as specified in UsePage argument is completely loaded. 

If the page with a title as specified in UsePage cannot be loaded within the default timeout period of 30 seconds, the function will fail.

If the page title is the correct one as shown in the browser at replay, and if the web page fails to load within the default timeout period, the amount of time 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.

If the first character of the page title as shown in the browser at replay is not the same character as in the UsePage line, you receive the Page not found error message (default behavior). A possible reason is that a previous step did not execute correctly and so did not go to this new page - another possible reason is that the web site did change and the page title needs to be changed.

The default behavior of the UsePage function is to allow the script to continue execution as soon as the web page finishes loading and the first character of a the page title matches the first character of the title specified in the UsePage function. You can change this default behavior by setting the #UsePageExact system variable to 1 before the UsePage function. The UsePage function will now wait for the web page to be loaded with the fully specified page title, or fails if the title of the loaded web page starts to deviate from the specified title.
The complement to the exact matching behavior invoked by setting the #UsePageExact system variable to 1 is to use "wildcards" in the UsePage function. Wildcard behavior is invoked by truncating characters from the end of the web page title. This can be useful if the end of the web page title can vary each time the script is executed.

Some examples:

The UsePage function in the following code will succeed as long as the title of the loaded web page begins with the letter "W". (Fuzzy match on "W").
' Wait for the WinTask home web page to be loaded.
UsePage("Macro and Data Extraction with WinTask - the automation software for Windows and internet")

The UsePage function in the following code will fail if the title of the loaded web page begins with "Macros". ("Macros" mismatches "Macro")
' Require the web page title to exactly match the UsePage parameter.
#UsePageExact=1
UsePage("Macros and Data Extraction with WinTask - the automation software for Windows and internet")

The UsePage function in the following code uses wildcards to successfully match on any web page title that begins with "Macro". The presence of the #UsePageExact system variable will not cause UsePage to fail unless the title deviates from "Macro" in the first five characters.
' Require the web page title to start with "WinTask" but allow any text to follow it.
#UsePageExact=1
UsePage("Macro")

See also

HTML Element Not Found
Window Not Found