Class ScreenshotHandler

java.lang.Object
com.norconex.collector.http.fetch.util.DocImageHandler
com.norconex.collector.http.fetch.impl.webdriver.ScreenshotHandler
All Implemented Interfaces:
IXMLConfigurable

public class ScreenshotHandler extends DocImageHandler

Takes screenshot of pages using a Selenium WebDriver. Either the entire page, or a specific DOM element. Screenshot images can be stored in a document metadata/field or in a local directory.

XML configuration usage:


<cssSelector>(Optional selector of element to capture.)</cssSelector>
<targets>[metadata|directory] (One or both, separated by comma.)</targets>
<imageFormat>(Image format. Default is "png".)</imageFormat>
<!-- The following applies to the "directory" target: -->
<targetDir
    field="(Document field to store the local path to the image.)"
    structure="[url2path|date|datetime]">
  (Local directory where to save images.)
</targetDir>
<!-- The following applies to the "metadata" target: -->
<targetMetaField>(Document field where to store the image.)</targetMetaField>

The above XML configurable options can be nested in a supporting parent tag of any name. The expected parent tag name is defined by the consuming classes (e.g. "screenshot").

Since:
3.0.0
Author:
Pascal Essiembre