Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › AI agents

How to Use an AI Agent to Capture a Webpage Screenshot and Extract Its Page Title

By Freedom251 Team · · 5 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a browser automation tool such as Playwright: navigate to the URL, save a screenshot, and get the page title directly with page.title(). The screenshot preserves visual evidence; the title comes back as text, so there is no need to ask a vision model to read it from the image.

Capture a screenshot and read the title with Playwright

This Node.js example opens a page, saves its full scrollable contents, retrieves the browser page title, and reports the final URL. It also closes the browser if navigation or capture fails.

As an Amazon Associate I earn from qualifying purchases.

const { chromium } = require('playwright');

(async () => {
  const url = 'https://example.com';
  const browser = await chromium.launch();

  try {
    const page = await browser.newPage();
    await page.goto(url, { waitUntil: 'load', timeout: 30000 });
    await page.screenshot({ path: 'page.png', fullPage: true });

    const title = await page.title();
    console.log({
      title,
      finalUrl: page.url(),
      screenshot: 'page.png',
      capture: 'success'
    });
  } catch (error) {
    console.error({ capture: 'failed', error: error.message });
    process.exitCode = 1;
  } finally {
    await browser.close();
  }
})();

Install Playwright and its browser before running the script, following the Playwright Page API documentation. The example uses the documented navigation, screenshot, and title APIs. waitUntil: 'load' waits for the page load event, not for every application-specific update; a site may continue rendering after that point.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose what the screenshot should show

Current viewport

To capture only what is visible in the browser viewport, omit fullPage:

#1 Best Overall
SunFounder PiDog AI Robot Dog Kit for Raspberry Pi 5/4/3B+/Zero 2W, Openclaw LLMs ChatGPT/Gemini/Grok, Voice&Video Recognition, Python, App, Gyroscope, Camera (RPI NOT Included)
  • AI-Powered Raspberry Pi Robot Dog — PiDog: Powered by Raspberry Pi (5/4B/3B+/3B/Zero 2W), OpenClaw, and multi-LLMs like ChatGPT, Gemini, Grok, DeepSeek, Qwen & Ollama. With 12 servos, camera, gyroscope, hearing & touch sensors, PiDog can see, listen, talk, move, and interact intelligently. Supports OpenCV, MediaPipe, TTS & STT, app control, FPV & Python. A great STEM robotics gift for students, makers & tech enthusiasts—perfect for birthdays and holidays. (Raspberry Pi not included)
  • Realistic Dog-like Movements: PiDog's 12 powerful servos enable 32 dog-like actions, including walking, sitting, standing, shaking its head, wagging its tail, and performing playful tricks, closely mimicking a real dog and providing an engaging experience. This is an AI development robot product designed for engineers, suitable for ages 15 and above
  • Rich Sensor Suite for Interactive Experiences: PiDog features ultrasonic, touch, gyroscope, sound, camera, speaker and microphone. These provide it with advanced hearing, vision, and touch, enabling it to see, detect obstacles, respond to touch, and recognize sounds, making interactions highly engaging
  • AI-Powered Interactions with OpenClaw & Multi-LLMs. PiDog combines voice, vision, and gesture recognition for immersive AI experiences. Powered by OpenClaw and multi-LLMs like ChatGPT, Gemini, Grok, DeepSeek, Qwen, Doubao, and Ollama (local LLMs), it can understand questions, respond naturally through TTS & STT, recognize math problems, interpret hand gestures, and hold smart conversations. OpenClaw also enables customizable AI behaviors and personalized robotics development, helping users create their own intelligent robotic companion
  • Comprehensive Learning Resources and Support: PiDog offers detailed online documentation, video tutorials, prompt technical support, and an active forum community, ensuring beginners can easily complete all projects and enjoy a great experience
await page.screenshot({ path: 'viewport.png' });

Full scrollable page

Set fullPage: true to capture the full scrollable document in one image. Long pages can produce very tall files, so choose this only when the entire page is useful.

await page.screenshot({ path: 'full-page.png', fullPage: true });

A single element

Use a locator when the task concerns one section rather than the whole page:

await page.locator('main').screenshot({ path: 'main.png' });

Playwright’s MCP screenshot tool treats a target-element capture and full-page capture as separate modes; do not assume they can be combined in that tool. Its guide also describes output formats such as PNG, JPEG, and WebP. See Playwright MCP screenshots for tool-specific behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
AI Robotic Arm Kit with Servo Motors – LeRobot SO-ARM101 Pro Low-Cost (Without 3D Printed Parts) | 6-DOF, Open-Source, Compatible with NVIDIA Jetson
  • Optimized AI Arm Kit for LeRobot & Hugging Face Projects – The SO-ARM101 is an upgraded low-cost robotic arm servo motor kit designed for AI robotics enthusiasts and developers. Fully compatible with LeRobot and Hugging Face frameworks, it supports imitation learning and reinforcement learning, making it ideal for real-world robotics applications. (3D-printed parts not included.)
  • Enhanced Wiring & Performance – Compared to the SO-ARM100, the SO-ARM101 features improved wiring to prevent disconnection at joint 3 and eliminates range-of-motion limitations. The leader arm uses optimized gear ratio motors for smoother performance—no external gearboxes required.
  • Real-Time Leader-Follower Functionality – New real-time tracking allows the leader arm to follow the follower arm, enabling human intervention and correction during reinforcement learning (RL) training. Perfect for hands-on AI robotics development and research.
  • Open-Source, DIY-Friendly & Nvidia-Compatible – Developed by TheRobotStudio, this open-source AI Arm kit integrates seamlessly with the LeRobot platform, offering PyTorch-based datasets, simulation, training, and deployment tools. Fully compatible with Nvidia Jetson edge devices, including reComputer Mini J4012 Orin NX 16 GB.
  • Comprehensive Learning Resources – Includes detailed open-source assembly and calibration guides, testing tutorials, and deployment instructions. From wiring to AI training, get everything you need to start building, teaching, and optimizing your robotic arm for grasping and placing tasks.

Use the right output for the agent’s question

Question Use Reason
What does the layout, color, or rendering look like? Screenshot It preserves visual appearance.
What text or structure is on the page? Accessibility snapshot It provides structured page information.
How do I interact with a control? Snapshot references or locators They provide structured targets for actions.
What is the browser page title? await page.title() It returns title text directly instead of requiring OCR.

A screenshot is useful for visual inspection, including charts or canvas content. It is not a substitute for a structured snapshot when the agent needs to understand page text or choose an interaction target. Playwright’s MCP guide puts it plainly: “Screenshots are for looking at, not for acting on.” See the screenshot guide and the snapshot guidance.

Handle JavaScript-rendered pages and changing titles

A static HTTP response may not contain content that appears only after JavaScript runs. A real browser session can inspect the rendered page; Playwright is one way to do that. For a single-page app that updates its title after an internal navigation, wait for the relevant state before calling page.title(). Use a condition tied to the page or action rather than inserting an arbitrary delay: the correct condition depends on the site.

For example, if the title is expected to become a known value after an action, wait for that title before capturing:

Rank #3
SunFounder AI Robot Kit with Raspberry Pi Zero 2 W+32G TF Card, ChatGPT-4o Enabled with Voice Command & Video Recognition, App Control, FPV, 12 Servos, Gyroscope, Camera, Mic
  • Raspberry Pi AI Robot: powered by Raspberry Pi (5/4B/3B+/3B/Zero 2W), features 12 servos and sensors for vision, hearing, and touch. Integrated with ChatGPT-4o, it responds to complex queries. With app control and FPV, users can manage and see its view in real-time. It supports Python programming
  • Realistic Movements: 12 powerful servos enable 32 actions, including walking, sitting, standing, shaking its head, wagging its tail, and performing playful tricks, closely mimicking a real and providing an engaging experience
  • Rich Sensor Suite for Interactive Experiences: features ultrasonic, touch, gyroscope, sound, camera, speaker and microphone. These provide it with advanced hearing, vision, and touch, enabling it to see, detect obstacles, respond to touch, and recognize sounds, making interactions highly engaging
  • Engaging Interactions with ChatGPT-4o: with ChatGPT-4o enables voice interactions and visual recognition, making it smarter and more responsive. Users can have natural conversations, solve math problems via the camera, and interpret gestures, creating diverse and fun interactions
  • Comprehensive Learning Resources and Support: offers detailed online documentation, video tutorials, prompt technical support, and an active forum community, ensuring beginners can easily complete all projects and enjoy a great experience
await page.waitForFunction(() => document.title === 'Expected title', {
  timeout: 10000
});
const title = await page.title();

Replace the expected title with the actual value for your task. If the title is not known in advance, wait for a meaningful page-specific signal, such as a locator becoming visible, then retrieve the title. Cloudflare also documents CDP-controlled browser sessions for screenshots and live DOM state, and labels its browser tools Beta; availability and terms may change. See Cloudflare Agents browser tools.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Return enough information to trust the result

Have the agent report the title together with the final URL, screenshot path, capture scope, and any error. This distinguishes a successful capture from a redirect, an incomplete load, or a file-writing problem. Do not report a title as verified when navigation or capture failed.

  • Use the final URL from the browser after redirects, not only the requested URL.
  • Record whether the image covers the viewport, full page, or one element.
  • Report navigation timeouts, blocked pages, missing titles, and screenshot write failures as failures.
  • For sensitive pages, consider masking selected locators; screenshot masking options are documented in the Page API.

If using Playwright’s agent CLI snapshot workflow, take a fresh snapshot after navigation. References belong to a snapshot and become invalid when the page changes, as explained in the snapshot documentation.

Rank #4
AI Robotic Arm Kit Hiwonder SO-ARM101 Embodied Imitation Learning Open Source 6-Axis Robot Arm 12 High-Torque Bus Servo Motors AI Vision Recognition (Advanced Kit, Included 3D Printed Part, Assembled)
  • 【End-to-End Imitation Learning】Hiwonder SO-ARM101 robot arm is an embodied intelligent hardware platform compatible with the Lerobot open-source framework. It provides developers with streamlined access to shared code, templates, and pre-trained models to explore the latest advancements in AI research.
  • 【Dual-Camera Vision System】Equipped with both a gripper-mounted camera and an external camera, the system supports both precise manipulation and environmental awareness for accurate imitation learning.
  • 【Hiwonder High-Performance Bus Servos】Featuring 12 high-torque bus servo motors with magnetic feedback, the Hiwonder SO-Arm101 robotic arm delivers smooth, stable motion, eliminating issues like power deficiency and jitter.
  • 【Professional Control & Debugging】Integrated with the Hiwonder BusLinker V3.0 debugging board, the system supports servo scanning, real-time status monitoring, and trajectory control. The professional PC software simplifies device calibration and debugging, making it accessible for both researchers and hobbyists.
  • 【Open-Source Compatibility】The SO-ARM101 robotic arm is designed to be fully compatible with the LeRobot open-source project. We acknowledge the contributions of the open-source community; all trademarks and copyrights belong to their respective owners.

Common problems and fixes

Symptom Likely cause What to do
Navigation times out The page did not reach the selected load condition in time, or the destination is slow or blocked. Report the navigation failure; check that the URL is permitted and reachable, then adjust the timeout only if the task warrants it.
Title is blank or outdated The page has not reached the relevant render or app transition. Check the final URL and wait for a page-specific condition before calling page.title().
Screenshot exists but misses content The capture used the viewport instead of full-page mode, or content was not yet rendered. Choose the required scope and wait for the relevant page state before capture.
Element screenshot fails The locator does not match the intended element or the element is not ready. Verify the selector and wait for the target element to become available.
No screenshot file appears The capture failed or the process could not write to the requested path. Surface the error, confirm the output directory is writable, and do not return a success status.
Agent acts on stale references Navigation invalidated references from an earlier CLI snapshot. Take a new snapshot and use its current references.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. One GET request can return an image or PDF; its page-info tool can return page information including the title. Cookie banners, newsletter popups, and chat widgets are removed before the shot, with each cleanup step configurable. Bot checks, blank pages, and failed loads are not billed, and response headers report the page verdict and billing status. Its MCP server lets AI agents use take_screenshot, get_page_info, and capture_pdf.

For a screenshot, use this cURL request; replace the target URL and supply your API key. See the ScreenshotNeo documentation for request options.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

ScreenshotNeo includes 1,000 screenshots a month free with no card; paid plans start at $5 for 3,000. Sign up for the free plan.

FAQ

Does a screenshot prove what the page title is?

No. The screenshot records appearance; retrieve the title as text with the browser page API and report both outputs separately.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

AI agentsbrowser automationpage titlePlaywrightweb screenshots

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.