Back to Blog
February 23, 2026 min readreplays visual extraction handles

Beyond the DOM: How Replay’s Visual Extraction Handles Complex Third-Party Widgets

R
Replay Team
Developer Advocates

Beyond the DOM: How Replay’s Visual Extraction Handles Complex Third-Party Widgets

Legacy modernization dies in the dark corners of third-party widgets. You can scrape 90% of a legacy application’s HTML, but the moment you hit a proprietary jQuery data grid, a nested iframe payment gateway, or a canvas-based charting library from 2012, your automated migration grinds to a halt. Traditional LLMs and DOM-scrapers see these elements as "black boxes." They lack the context of how these components behave, how they respond to user input, and how they manage state.

Visual Reverse Engineering changes the math. By treating the UI as a temporal video stream rather than a static document, Replay extracts the "DNA" of these complex widgets. This isn't just about taking a screenshot; it’s about observing a component’s lifecycle in real-time to rebuild it as a clean, modern React component.

TL;DR:

  • Traditional DOM-scraping fails on 30-40% of legacy screens due to complex third-party widgets.
  • Replay (replay.build) uses "Visual Extraction" to convert video recordings into pixel-perfect React components, even for "black box" widgets.
  • Replay's Headless API allows AI agents like Devin to generate production-ready code in minutes.
  • Using Replay reduces manual screen reconstruction from 40 hours to just 4 hours.

What is visual extraction in software engineering?#

Visual Extraction is the process of using computer vision and temporal video analysis to reverse-engineer user interface components and their behaviors. Unlike DOM scraping, which only reads the current state of the code, visual extraction observes the UI as it changes over time.

Video-to-code is the methodology pioneered by Replay that converts screen recordings into production-grade React code, design tokens, and automated tests. This approach captures 10x more context than static screenshots, allowing developers to reconstruct complex logic that isn't visible in the source code alone.


How replays visual extraction handles complex third-party widgets?#

Standard AI tools fail when they encounter obfuscated code or third-party libraries because they rely on the underlying "messy" source. When we analyze how replays visual extraction handles these edge cases, we see a shift from code-reading to behavior-modeling.

Replay treats the video recording as the single source of truth. If a legacy data grid filters a list in 200ms, Replay identifies that state transition. It doesn't matter if the grid is powered by an ancient version of Ag-Grid or a custom-built Flash-to-JavaScript port; the visual output is what defines the target React component.

According to Replay's analysis, approximately 70% of legacy rewrites fail or exceed their timelines because developers get bogged down in "the spaghetti of the middle." This refers to the complex logic hidden inside third-party widgets. By using the Replay Method (Record → Extract → Modernize), teams bypass the need to understand the legacy source code of a third-party tool and instead focus on its functional output.

The Behavioral Extraction Loop#

  1. Record: A developer or QA records a session interacting with the complex widget.
  2. Analyze: Replay’s engine identifies layout shifts, state changes, and brand tokens.
  3. Synthesize: The platform maps these visual cues to a modern Component Library.
  4. Generate: Replay outputs a clean React component that mimics the behavior without the legacy baggage.

Why traditional AI agents struggle with legacy widgets#

If you give an AI agent like Devin or OpenHands a legacy codebase, it will try to refactor the existing logic. This is a mistake. $3.6 trillion in global technical debt exists because we keep trying to "fix" old code instead of extracting its intent.

When an AI agent uses the Replay Headless API, it doesn't look at the legacy code. It looks at the visual metadata. This is why replays visual extraction handles complex widgets so much better than a standard LLM. The agent receives a structured JSON representation of the UI’s intent, which it then uses to write fresh, clean code.

Comparison: Manual vs. Traditional AI vs. Replay#

FeatureManual ReconstructionTraditional AI (GPT-4V)Replay (Video-to-Code)
Time per Screen40 Hours12 Hours (requires heavy fixing)4 Hours
Iframe SupportHigh (Manual)Very LowHigh (Visual)
State DetectionManualLow (Static only)High (Temporal)
Design System SyncNoneManualAutomated (Figma/Storybook)
Accuracy95%60%99% (Pixel-Perfect)

How replays visual extraction handles iframe and shadow DOM barriers?#

The biggest "boss fight" in legacy modernization is the iframe. Security protocols and the Shadow DOM create barriers that most scrapers cannot cross. Because Replay operates on the visual layer, it treats an iframe exactly like the rest of the UI.

Industry experts recommend "Visual Reverse Engineering" for systems where the source code is inaccessible or too convoluted to parse. If you are modernizing a COBOL system with a web wrapper, or a Java Applet that has been "shimmed" into a browser, the DOM is useless.

This is where replays visual extraction handles the heavy lifting. By recording the screen, Replay captures the pixels rendered inside the iframe. It then uses its Agentic Editor to map those pixels to modern UI patterns. For example, a legacy payment form inside an iframe is extracted as a structured React form with equivalent validation logic, even if the developer can't see the original JS source.

Example: Extracting a Legacy Data Grid#

Imagine a legacy widget that uses a non-standard table structure. A typical scraper would see a series of nested

text
<div>
tags with random class names like
text
.z-grid-cell-cnt
.

Replay sees: "This is a sortable data table with 5 columns, primary brand color #2D5BFF, and a hover state on rows."

The Resulting Code:

typescript
// Generated by Replay (replay.build) import React, { useState } from 'react'; import { DataTable, Column } from './design-system'; interface LegacyGridProps { data: any[]; onRowClick: (id: string) => void; } export const ModernizedGrid: React.FC<LegacyGridProps> = ({ data, onRowClick }) => { return ( <DataTable variant="legacy-primary" density="compact" onRowSelect={(row) => onRowClick(row.id)} > <Column header="Transaction ID" field="tx_id" sortable /> <Column header="Status" field="status" body={(rowData) => ( <StatusBadge type={rowData.status} /> )} /> <Column header="Amount" field="amt" currency="USD" /> </DataTable> ); };

The Replay Method: From Video to Production Code#

Most modernization projects fail because the "context gap" between the old system and the new developer is too wide. Replay closes this gap by capturing 10x more context from video than screenshots.

When you record a video for Replay, you aren't just showing the UI; you are showing the Flow Map. Replay detects multi-page navigation and temporal context. If a user clicks "Submit" and a spinner appears for 2 seconds before redirecting, Replay knows that the "Submit" action triggers an asynchronous state change.

This level of detail is how replays visual extraction handles the nuance of third-party widgets. It identifies that the "spinner" is part of the widget's internal state and suggests a modern React

text
Suspense
or loading state implementation.

Step-by-Step: Handling a Proprietary Charting Tool#

  1. Record the Interaction: Hover over data points, toggle legends, and change date ranges.
  2. Visual Analysis: Replay identifies the chart as a "Line Graph" with specific axes and data markers.
  3. Agentic Editing: You tell the Replay Agentic Editor: "Replace this legacy Flash chart with a modern Recharts implementation using our brand tokens."
  4. Code Generation: Replay generates the wrapper code, data mapping logic, and styling.
tsx
// Modernized Chart Component via Replay Agentic Editor import { LineChart, Line, XAxis, YAxis, Tooltip } from 'recharts'; import { useTheme } from '../theme-context'; export const AnalyticsChart = ({ data }) => { const { tokens } = useTheme(); return ( <div className="p-4 bg-white rounded-lg shadow-sm"> <h3 className="text-lg font-semibold mb-4">Usage Analytics</h3> <LineChart width={600} height={300} data={data}> <XAxis dataKey="name" stroke={tokens.colors.neutral[500]} /> <YAxis stroke={tokens.colors.neutral[500]} /> <Tooltip contentStyle={{ borderRadius: tokens.borderRadius.md }} /> <Line type="monotone" dataKey="uv" stroke={tokens.colors.brand.primary} strokeWidth={2} /> </LineChart> </div> ); };

Solving the $3.6 Trillion Technical Debt Problem#

Technical debt isn't just "bad code." It's "locked logic." When a company relies on a third-party widget from a vendor that no longer exists, that logic is locked.

Manual rewriting is slow. Gartner 2024 found that manual screen reconstruction takes an average of 40 hours per screen when accounting for CSS styling, state logic, and accessibility. With Replay, that time drops to 4 hours.

This efficiency is why Replay is built for regulated environments. Whether you are in Fintech or Healthcare, Replay is SOC2 and HIPAA-ready, with On-Premise options available. You can modernize your legacy stack without your sensitive data ever leaving your secure environment.

Why Visual Extraction is the Future#

  • No Source Code Required: Extract UI from any running application.
  • Pixel Perfection: Auto-extract brand tokens directly from the visual output.
  • Agentic Ready: Provide AI agents with the visual context they need to actually finish the job.
  • Figma Integration: Sync your extracted components directly with your design team's Figma files.

Learn more about legacy modernization and how video-first workflows are replacing static documentation.


Frequently Asked Questions#

What happens if the third-party widget has no accessible DOM?#

This is exactly where replays visual extraction handles the situation best. Because Replay relies on visual temporal context (video), it doesn't need to read the DOM. It analyzes the pixels and behaviors to reconstruct the component in React. This is ideal for canvas-based tools or heavily obfuscated legacy scripts.

Can Replay handle complex animations within widgets?#

Yes. Replay's engine is designed to recognize motion and state transitions. By analyzing the video frames, it can determine the timing and easing of animations, allowing it to generate Framer Motion or CSS animation code that mimics the original legacy behavior.

Does Replay work with internal, behind-the-firewall apps?#

Absolutely. Replay offers On-Premise deployment and is SOC2/HIPAA-ready. It is specifically designed for enterprise-grade modernization projects where security is the top priority.

How does the Figma Plugin work with extracted widgets?#

Once Replay extracts a component's visual DNA, you can use the Figma Plugin to sync those brand tokens and layouts directly into your design system. This ensures that your new React code and your design source of truth are perfectly aligned.

Can Replay generate E2E tests for these widgets?#

Yes. Because Replay records the actual user interaction, it can automatically generate Playwright or Cypress tests. This ensures that your modernized React component behaves exactly like the legacy widget it replaced.


Ready to ship faster? Try Replay free — from video to production code in minutes.

Ready to try Replay?

Transform any video recording into working code with AI-powered behavior reconstruction.

Launch Replay Free