Checking whether a website is up

This recipe will show you how to check that a site is up, using the XMLHttp object we have seen in action in the Checking whether page links are broken recipe.

Getting ready

We will be using the Web_Functions.vbs function library, seen in the previous recipe, to take advantage of the objXMLHttp global variable, along with the InitXMLHttp() and DisposeXMLHttp() functions. Make sure the library is associated to the test.

How to do it...

Basically, here we will follow the same logic as in the Checking whether page links are broken recipe, but instead of getting the URL from the page links dynamically, we will just pass the URL to the function:

Function checkSiteIsUp(URL) If lcase(typename(oXMLHttp)) <> "xmlhttp" Then initXMLHttp() ...

Get Advanced UFT 12 for Test Engineers Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.