Principle:A9T9 RPA Screenshot Capture
| Knowledge Sources | |
|---|---|
| Domains | Browser_Automation, Screenshot_Capture |
| Last Updated | 2026-10-22 00:00 GMT |
Overview
Mechanism for capturing browser tab screenshots with rate-limit awareness and DPI-normalized scaling for use in visual search and OCR pipelines.
Description
Screenshot Capture is the process of obtaining a pixel image of the current browser tab for downstream computer-vision processing. In a Chrome extension, the `chrome.tabs.captureVisibleTab` API provides this, but with two critical constraints that must be handled:
- Rate limiting: Chrome allows a maximum of 2 captures per second. Exceeding this silently fails. The capture service must space requests with a safety margin and optionally warn the user when a capture is delayed.
- DPI scaling: The captured image is in device pixels (which may be 2x on Retina displays), but the browser viewport uses CSS pixels. Image search and OCR produce coordinates in image pixels; these must be normalized to CSS pixels for click targeting. The `screenshotRatio` (device pixels / CSS pixels) is computed from the captured image dimensions and the viewport dimensions.
For full-page captures, the service scrolls and stitches multiple captures together, respecting the maximum canvas size limit (32767 pixels per dimension).
Usage
Use this principle when any visual automation pipeline needs a screenshot as input. The DPI normalization is essential for correct coordinate mapping between image-space results and viewport-space actions.
Theoretical Basis
DPI normalization:
Rate limiting:
Failed to parse (syntax error): {\displaystyle \Delta t_{\min} = \frac{1000}{\text{MAX\_CAPTURES\_PER\_SECOND}} + \text{safetyMargin} }