Thursday, April 11, 2013

How to check successful download of a file?

We can simply use web_get_int_property(), a very helpful function to check this. 

Use the below code:

int pdf_size;

lr_start_transaction("Download_PDF");
web_link("PDF download",
        "Text=PDF download",
        "Snapshot=my_pdf.inf",
        LAST );

pdf_size = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);
lr_output_message("The download size of PDF file is : %d", pdf_size);

if(pdf_size > 10000)
{
lr_end_transaction("Download_PDF ", LR_PASS);
}

else
{
lr_end_transaction("Download_PDF ", LR_FAIL);
}
    return 0;
Click here to know more
}

HTTP_INFO_DOWNLOAD_SIZE gives size (in bytes) of the last download, including header, body, and communications overhead (for example, NTLM negotiation).

No comments:

Post a Comment