Lightpanda browser 1.0.6, released on November 27, captures screenshots that reflect page element positions. Developers can use page layouts instead of single-column text images. Form error reading and startup and memory improvements are also included.

1. Screenshots follow element positions

New screenshots draw boxes at positions set by the page layout engine. Unlike the previous approach of stacking elements in a single column, element coordinate queries and image generation now use the same layout basis.

This change applies to Page.captureScreenshot and CLI PNG output. Of CDP and BiDi, the protocols that let external tools control the browser, the latter's screenshots also use this approach.

Screen sizing also changes. The root container follows the browser viewport width instead of a fixed 1920 pixels. Automation targeting narrow screens can thus use layout calculations that match the viewing area.

Page.getLayoutMetrics also returns values from the same layout engine. Capture and page size queries now share a calculation basis, which matters for tasks that use images to handle element positions.

2. Layout calculations account for spacing and overlap

Layout support now handles padding, box sizing, margins, and gaps in flex layouts. Flex arranges elements horizontally or vertically, and text between elements is now treated as an item too.

margin: 0 auto centers a box, while margin-left: auto pushes it to the right. These changes affect where text appears and how far apart boxes sit.

Explicit z-index values, which define stacking order, are considered when determining which element is targeted at a given point. On pages with overlapping elements, this affects both visible layout and target selection.

3. Read form errors and choose a capture mode

Form inspection gains an option to return validation messages for each input field. Automation agents can go beyond detecting a rejected submission to read why an input was not accepted.

BiDi adds script registration before page execution and handling of user-facing prompts, among other features. This expands the range of actions available to tools that control the browser externally.

The CLI adds the following syntax for allowing timezone overrides, selecting PNG rendering modes, and setting agent temperature.

--cdp-allow-timezone-override
--png-mode layout|reader
agent --temperature <FLOAT>

Select --png-mode reader if you need the previous single-column text capture. The agent's /screenshot retains the previous approach by default, and PDF output also uses the previous approach.

4. Weigh layout benefits against migration costs

Layout-based capture helps automation that uses images and element coordinates together. In return, developers whose downstream processing relies on the old image format must check whether to specify a mode or adapt to the new default.

Timezone changes require the enabling option, and the configured timezone is shared across the process. This limits setups that seek different timezones for each session within one process.

5. Reduce startup work and page structure storage overhead

The company says it removed duplicate loading of CA certificates used to verify web connection identities at startup. That work took about 30% of a simple fetch. This shows the weight of startup work in short page fetches.

The company says node counts for HTML specification semantic tree output fell from 672k to 314k, reducing page structure storage overhead. PNG rendering now processes 128 rows at a time to reduce memory use.

Lightpanda 1.0.6 aligns capture and element coordinate layouts to provide more information for screen automation, while reducing waste in startup processing and structure storage.