Downloading a file using XMLHttp

This recipe will show you how to download a file using the XMLHttp object, which we have seen in action in the Checking whether page links are broken recipe. Here we will expand on a theme and see how to synchronize our script using the onreadystatechange event handler to report on the progress of our download. The code includes the required modifications, and is the same as the one I used in a project a few years ago.

Getting ready

From the File menu, navigate to New | Function Library or use the Alt + Shift + N shortcut. Name the new function library as Web_Download.vbs. To use the AutoItX COM object, go to https://www.autoitscript.com/site/autoit/downloads/ to download and install AutoIt. This is absolutely necessary ...

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.