Class PlaywrightScreenshotHandler
java.lang.Object
com.norconex.crawler.web.fetch.util.AbstractScreenshotHandler<com.microsoft.playwright.Page>
com.norconex.crawler.web.fetch.impl.playwright.PlaywrightScreenshotHandler
- All Implemented Interfaces:
Configurable<ScreenshotHandlerConfig>
public class PlaywrightScreenshotHandler
extends AbstractScreenshotHandler<com.microsoft.playwright.Page>
Takes screenshots of pages using a Playwright Page.
Either the entire page viewport, or a specific DOM element identified by
a CSS selector. Screenshot images can be stored in a document
metadata/field or in a local directory.
Unlike the Selenium-based ScreenshotHandler, Playwright
captures element screenshots natively without manual image cropping.
- Since:
- 4.0.0
- See Also:
-
Field Summary
Fields inherited from interface com.norconex.commons.lang.config.Configurable
PROPERTY -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.norconex.crawler.web.fetch.util.AbstractScreenshotHandler
getConfiguration, takeScreenshot
-
Constructor Details
-
PlaywrightScreenshotHandler
public PlaywrightScreenshotHandler() -
PlaywrightScreenshotHandler
-
-
Method Details
-
captureScreenshotBytes
protected byte[] captureScreenshotBytes(com.microsoft.playwright.Page page) Captures a screenshot using Playwright's native API. When a CSS selector is configured, only the matching element is captured (no manual image cropping required); otherwise the full viewport is captured.- Specified by:
captureScreenshotBytesin classAbstractScreenshotHandler<com.microsoft.playwright.Page>- Parameters:
page- the Playwright page to screenshot- Returns:
- screenshot bytes
-
toString
- Overrides:
toStringin classAbstractScreenshotHandler<com.microsoft.playwright.Page>
-
equals
- Overrides:
equalsin classAbstractScreenshotHandler<com.microsoft.playwright.Page>
-
canEqual
- Overrides:
canEqualin classAbstractScreenshotHandler<com.microsoft.playwright.Page>
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractScreenshotHandler<com.microsoft.playwright.Page>
-