Web, how to detect Page not found

When you record your Web navigation, each time a new page is loaded, the statement UsePage is generated automatically in the script. At replay, WinTask waits until the page specified in the UsePage statement is loaded. If the system variable #UsePageExact is at its default value 0, if at replay a page starting with the first same characters as the one which has been recorded is found, the Page is found. If no page is found, after #ActionTimeout seconds (default value is 30 secs), an error is reported. Depending on the value of #IgnoreErrors, either the script is stopped, either a negative return code is stored.

The example below shows the use of those system variables for detecting a page not found.

 

StartBrowser("IE", "www.wintask.com/download-wintask")

 

'We want to test if the page is loaded, so if the page "WinTask Download - Free Version 30 days" is loaded

 

#UsePageExact=1
'We want to test the return code, so we set the #IgnoreErrors system variable to 1

#IgnoreErrors=1
'We shorten the delay before notifying the error

#ActionTimeout=10

 

ret=UsePage("WinTask Download - Free Version 30 days")

if ret <> 0 then

msgbox("page not found")

stop

else

msgbox("page found")

endif