SaveElementImage - web automation method

Not available in Open Twebst edition!
Scrap the image an HTML element from a web site and save it to a graphic file (BMP, GIF, JPG, PNG).

Applies to:
Element
  elementObj.SaveElementImage("file_name");
Arguments:
Remarks:
This web scraping method extracts the image (as it appears on the screen) of an HTML element and saves it to a specified graphic file. The supported image file formats are: BMP, GIF, JPG, PNG. An extension for the image file name must be provided. In case of an error, a web macro exception is thrown and the lastError property is set to FAIL_ERROR.
Example:
// Save all the existing images in a web page.
var coreObj = new ActiveXObject("Twebst.Core");
var browser = coreObj.StartBrowser("http://www.codecentrix.com");

var images = browser.FindAllElements("img");
for (i = 0; i < images.length; ++i)
{
	images(i).SaveElementImage("c:\\img" + i + ".jpg");
}
		
See also:
Element | Highlight

© 2014 CodeCentrix Software. All rights reserved.