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

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Use Symfony Panther when you need a screenshot of a Symfony application as a real browser sees it. Install it as a development dependency, provide ChromeDriver or GeckoDriver, navigate with a Panther client, and call takeScreenshot(). If by “screenshot API” you mean a hosted service that captures any remote URL, that is a separate architecture: your Symfony code makes an HTTP request while the vendor renders the page remotely.

How do I take a screenshot in Symfony?

The native Symfony workflow is Panther, the end-to-end testing client that drives Chrome or Firefox through WebDriver. Install it with Composer:

composer require --dev symfony/panther

Then create a browser client, request a page and save the image:

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

use SymfonyComponentPantherClient;

$client = Client::createChromeClient();
$client->request('GET', 'https://example.com');
$client->takeScreenshot('screen.png');

The path is an output path chosen by your test or script. Store it in a deliberate test-artifact directory in CI rather than assuming a universal location. Panther also provides a Firefox client:

$client = Client::createFirefoxClient();

Use Panther for browser-rendered output, JavaScript behavior, visual debugging and end-to-end tests. For a Symfony application test, PantherTestCase can start the application with its built-in PHP server and gives you the usual PHPUnit test-case workflow.

How do I use Symfony Panther to take a screenshot?

Install a browser driver

Panther communicates with a real browser through WebDriver. If ChromeDriver or geckodriver is not already installed and available, Symfony documents using dbrekelmans/bdi:

composer require --dev dbrekelmans/bdi
vendor/bin/bdi detect drivers

Drivers may be placed on your system PATH or in the project’s drivers/ directory. The browser and driver versions installed on a particular machine must be compatible; check the versions in your CI image or local environment rather than assuming any arbitrary package combination will work.

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

Put the capture in a PHPUnit test

<?php

namespace AppTests;

use SymfonyComponentPantherPantherTestCase;

final class HomepageTest extends PantherTestCase
{
    public function testHomepageScreenshot(): void
    {
        $client = static::createPantherClient();
        $client->request('GET', '/');
        $client->takeScreenshot('var/screenshots/homepage.png');

        self::assertSelectorTextContains('h1', 'Welcome');
    }
}

Use an absolute URL when testing an external site. With PantherTestCase, a relative path targets the application server started for the test. Make sure the page is ready before capturing: wait for the element or state your test needs, instead of taking a screenshot immediately after a navigation that triggers asynchronous rendering.

Capture failures automatically

The Panther PHPUnit extension supports PANTHER_ERROR_SCREENSHOT_DIR. Set that environment variable to a writable directory to save screenshots after failed or errored tests. This is useful in CI because the artifact shows the rendered browser state at the point of failure. Keep this setting separate from intentional screenshots so diagnostic files do not overwrite approved visual artifacts.

Debug a headed browser

Panther normally runs headless in automation. Set PANTHER_NO_HEADLESS when you need to see the browser while diagnosing a test locally. Browser window sizing affects the resulting image dimensions, so configure a consistent size when comparing screenshots between developer machines and CI.

What must be installed before Panther can capture?

  • A Symfony project with Panther installed as a development dependency.
  • Chrome plus ChromeDriver, or Firefox plus geckodriver.
  • Drivers discoverable on PATH or in the project’s drivers/ directory.
  • A display setup for headed runs; CI jobs normally use headless mode.
  • Network access if the URL is outside the test application.

Panther uses the WebDriver protocol, so browser/driver compatibility, executable permissions, sandbox restrictions and the CI container’s shared libraries all matter. A driver can be present yet fail to start if its browser version or operating-system dependencies do not match.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Can Symfony BrowserKit take screenshots?

No. Symfony’s kernel client and HttpBrowser are useful faster alternatives, but they do not provide real-browser screenshot capture. The kernel client directly exercises the Symfony kernel and is available only for Symfony applications. HttpBrowser sends real HTTP requests (including to external sites when configured with HttpClient), but it is implemented in PHP and does not execute JavaScript, apply browser CSS rendering or expose advanced browser features.

Choose the client based on the assertion:

Requirement Recommended client Reason
Controller, response or security checks Kernel client Fast in-process Symfony requests
External HTTP request or DOM-oriented check without JavaScript HttpBrowser Real HTTP, but no browser rendering
JavaScript, CSS layout, browser interaction or screenshots Panther Real Chrome or Firefox through WebDriver

Switching from BrowserKit to Panther is therefore not a cosmetic change: it adds a browser and driver lifecycle, but it is required when the rendered result itself is under test.

How should I handle dynamic pages before a screenshot?

  • Navigate to the exact route and wait for the application state your assertion requires.
  • Use a stable viewport and browser choice when images are compared over time.
  • Ensure fonts, images and JavaScript assets are available in the test environment.
  • Keep test data deterministic; timestamps, randomized content and rotating banners create false visual differences.
  • Write screenshots to unique or controlled paths so parallel jobs do not overwrite each other.

Panther’s screenshot is the browser’s current rendered state. It does not turn a failed API response, an authentication redirect or a missing asset into a meaningful product screenshot; assert the URL and key selectors before saving an image intended for review.

Rank #3
Sale
The Definitive Guide to symfony
  • Used Book in Good Condition

Should I use Panther or a hosted screenshot API?

These options solve different problems. Panther runs a browser you control as part of a Symfony test. A hosted API accepts an HTTP request and renders a URL on the provider’s infrastructure. The reviewed hosted-service documentation does not establish an official Symfony bundle or first-party Symfony integration, so treat it as a separate service integration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Option Where rendering runs Best fit What you manage
ScreenshotNeo Remote service Remote, unattended captures; clean output; AI-agent workflows API key, network access and request parameters
Symfony Panther Your local machine or CI browser End-to-end tests of your Symfony app and failure artifacts Browser, WebDriver, versions and CI dependencies
Another hosted screenshot API Vendor infrastructure Provider-specific schedules, comparisons or deploy checks Credentials, vendor API and page-access policy

ScreenshotNeo is the first hosted option to try because it removes consent banners, popups and chat widgets before capture, bills only clean shots, and has a $5 paid plan for 3,000 shots. It is a service rather than a Symfony test client.

When Panther is the better choice

  • The page is your Symfony application and the screenshot belongs to a PHPUnit test.
  • You need to inspect browser behavior, JavaScript events, cookies or authenticated test state locally.
  • You cannot send the page or credentials to a third-party renderer.
  • A failed test should leave an artifact from the exact CI browser session.

When a hosted API is more practical

  • You need scheduled or unattended captures of public URLs.
  • Your application should not maintain browser binaries and drivers.
  • You want service features such as bulk requests, signed links or webhooks.
  • Your Symfony code is orchestrating captures rather than asserting browser behavior.

For remote captures, inspect the provider’s credential handling and page-access model before sending authenticated URLs. Prefer bearer authentication in headers when the service supports it; do not expose a production key in a query string. Also inspect the final page status: a login page or server error can still render as a technically valid image.

Or skip the browser setup

ScreenshotNeo is a hosted website screenshot API and MCP server. One GET request returns PNG, JPEG, WebP or PDF. Before capture it accepts cookie/consent banners and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits cost nothing, and response headers report the page verdict and whether the request was billed.

Use the API from Symfony or any other application. The complete option list and authentication details are in the ScreenshotNeo documentation.

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://stripe.com -o shot.webp
import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

For Symfony, the same endpoint can be called with your preferred HTTP client, keeping the access key in an environment variable rather than source control. ScreenshotNeo also provides an MCP server with take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients.

Relevant ScreenshotNeo options

The service supports full-page captures with lazy images loaded, CSS-selector element captures, dark mode, 12 device presets or custom viewports, retina scale, PDF paper size/margins/landscape/page ranges, HTML/CSS-to-image, custom JavaScript and CSS, click-before-capture actions, hidden selectors, waits for a selector/delay/network idle, request or resource blocking, custom headers/cookies/user agents and Authorization, timezone and geolocation, transparent backgrounds, image resizing, chosen cache TTLs, signed links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API and an OpenAPI specification. Parameter names used by other screenshot APIs also work to ease migration.

Plan Included shots Price
Free 1,000 per month $0, no card
Starter 3,000 $5
Growth 15,000 $15
Pro 60,000 $39
Scale 250,000 $99
Business 1,000,000 $249

Yearly billing gives two months free, and every feature is available on every plan. Start with 1,000 free screenshots a month with no card.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting Panther screenshots

“Driver not found” or the browser will not start

Install the matching driver, run vendor/bin/bdi detect drivers, and verify the executable is on PATH or under drivers/. Check executable permissions and browser/driver version compatibility in the CI image.

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

The test hangs during navigation

Check outbound network access, DNS and TLS certificates. A page waiting forever on an unavailable asset can prevent the capture; make the test’s wait condition explicit and inspect the page logs.

The image is blank or missing styles

Confirm that the browser can reach CSS, JavaScript, fonts and images from the test environment. For a Symfony app, verify the test server is listening at the URL Panther uses and that assets are not restricted to a developer-only host.

The screenshot dimensions differ between runs

Use the same browser, viewport and headless/headed mode. Window sizing affects dimensions, and responsive breakpoints can change the layout even when the HTML is identical.

Failed tests do not leave an artifact

Set PANTHER_ERROR_SCREENSHOT_DIR to a writable directory in the PHPUnit environment, then publish that directory as a CI artifact. Ensure parallel jobs use separate paths or unique filenames.

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

FAQ

Does Panther support Firefox?

Yes. Panther provides Firefox client creation in addition to Chrome; the corresponding geckodriver must be installed and compatible with the browser.

Can I capture an authenticated Symfony page?

Yes, when the authentication state exists in the Panther-controlled browser, for example after logging in through the test flow. Keep those images and credentials inside your controlled test environment.

Is a hosted screenshot API a replacement for end-to-end tests?

No. A hosted capture confirms what a remote renderer received, while Panther can exercise your application and assert browser behavior inside the test suite.

Frequently Asked Questions

Does Panther support Firefox?

Yes. Use Panther’s Firefox client with a compatible geckodriver installation.

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

Can I capture an authenticated Symfony page?

Yes, if the Panther browser has been authenticated during the test flow; keep credentials and artifacts in your controlled environment.

Is a hosted screenshot API a replacement for end-to-end tests?

No. Hosted capture renders remotely, while Panther exercises and asserts your application in a browser test.

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.