Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Verify if page renders

Status
Not open for further replies.

sanvan

Programmer
Sep 13, 2006
3
US
I need to create a vbscript that will verify our website is available. I would like the script to request a page and check that it has rendered fully. If it has, the script can stop. If it hasn't, then I'd like the script to retry until it is successful or has 4 failed attempts. On the 4th failed attempt, it would send an email.

1. Is this possible to do with vbscipt?
2. If so, does anyone have a sample script?

I am fairly new to OOP (primarily a mainframe developer) so simple explanations are always appreciated. I have done simple scripts to stop/start services and send an email when a problem is encountered so I am a little familiar with the email process.

Thank you!
 
Should "search" the forum... I think it is treated many times, quick and dirty one way or another.
 
I performed many searches on the forum and found nothing. I used keywords such as "page renders" and "monitor page render" and "verify page". Being new to OOP, I imagine it is quite possible I am not using the proper syntax. Do you have any suggestions for finding the appropriate material on the forum?

Thanks.
 
I understand search may not be perfect. (For this occasion, I have also some difficulty.) Rather let me draft a quick script for purpose according to my concern at this moment.
[tt]

dim ieErr 'need this global variable declared

dim surl
surl="if checkpage(surl) then
wscript.echo surl & vbcrlf & "loading is successful"
else
wscript.echo surl & vbcrlf & "loading is failed for mulititude of reasons."
end if

function checkpage(surl)
'need and dependent on a global variable ieErr set up
'return true: no error; false: error occured
dim oie
ieErr=true 'reset global
set oie=wscript.createobject("internetexplorer.application","ie_")
'oie.visible=true 'uncomment duriing debug
oie.navigate surl
do while oie.readystate<>4 : wscript.sleep 500 : loop
oie.quit
checkpage=ieErr
end function

Sub ie_NavigateError(pDisp,URL,TargetFrameName,StatusCode,Cancel)
'need and dependent on a global variable ieErr set up
ieErr=false 'false for failure one reason or another
End Sub
[/tt]
This should be a relative sophisticated approach which is capable of capturing a multitude of reasons for the page to fail: site down, inexisiting specific page etc... It does not depend on localization error page redirection etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top