Use Protractor’s wrapped WebDriver instance: call browser.driver.takeScreenshot(), wait for its promise, and decode the returned base64 PNG into a file. The important limitation is that Selenium treats the capture area as implementation-dependent; verify that the resulting image actually includes content below the fold in the browser and driver versions used by your suite.
Save a Protractor screenshot as a PNG
Protractor exposes the underlying WebDriver object as browser.driver. Selenium’s JavaScript API returns a promise whose value is base64-encoded PNG data. Node.js can decode that value while writing the file.
const fs = require('fs');
browser.driver.takeScreenshot().then((pngBase64) => {
fs.writeFileSync('page.png', pngBase64, 'base64');
});
Run this after the page has reached the state you want to inspect. The promise must resolve before the test finishes or the browser session is closed. Put the output path in the directory your test runner retains as an artifact; that directory is a project and CI configuration choice.
A reusable helper with an explicit path
A helper makes it easier to name screenshots by test or failure condition. The function below returns the same promise that completes the file write, so a caller can await it.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →#1 Best Overall
- PORTABLE SCANNER FOR USE ON-THE-GO — The fastest and lightest mobile single-sheet-fed compact document scanner in its class¹
- QUICK DOCUMENT SCANNING ― This Epson ultra-fast scanner scans a single page as quickly as 5.5 seconds²; Windows and Mac compatible
- VERSATILE PAPER HANDLING ― Portable scanner scans documents up to 8.5 x 72 in; Also easily digitizes receipts and ID cards to make accounting, bookkeeping, and organizing simpler
- INTUITIVE, HIGH-SPEED SOFTWARE — Epson ScanSmart Software³ is a smart tool allowing you to easily scan, review, and save; Stay organized easily with the help of this Epson scanner
- EASY SETUP — USB-powered connect to your computer for quick and simple scanning; No batteries or external power supply required to operate portable document scanner; Standard Connectivity: USB 2.0
const fs = require('fs');
const path = require('path');
function saveScreenshot(fileName) {
const outputDir = path.resolve('test-artifacts', 'screenshots');
fs.mkdirSync(outputDir, { recursive: true });
const outputPath = path.join(outputDir, fileName);
return browser.driver.takeScreenshot().then((pngBase64) => {
fs.writeFileSync(outputPath, pngBase64, 'base64');
return outputPath;
});
}
// In an async Protractor spec:
it('captures the page', async () => {
await browser.get('https://example.com');
const file = await saveScreenshot('example-page.png');
console.log(`Screenshot written to ${file}`);
});
If your suite uses promise chains rather than async/await, return the chain from the test or hook:
it('captures the page', () => {
return browser.get('https://example.com')
.then(() => saveScreenshot('example-page.png'));
});
What “full-page” means here
takeScreenshot() does not provide a Protractor setting that universally guarantees every pixel below the fold. Selenium documents a best-effort preference order: an entire page when the implementation supports it, otherwise the current window, the visible portion of the current frame, or the display containing the browser. The result therefore depends on the browser, driver, Selenium implementation and window state.
In practice, treat “full page” as an outcome to validate, not a promise made by the method name. Open the PNG produced by your actual CI and local environments and check its height and lower sections. A tall page may still produce a viewport-sized image, while another browser-driver combination may include the complete document.
Checks to make in your suite
- Load the page and wait for the application state that should appear in the capture.
- Inspect the PNG dimensions and confirm that a known below-the-fold element is visible.
- Repeat the check in every browser and driver combination used by CI; there is no established version matrix that guarantees identical full-page behavior.
- Keep the screenshot promise in the test’s returned or awaited work so teardown cannot close the session first.
Capture at the right point in a test
A screenshot is most useful when it records the failure state, not merely the first page load. You can call the helper after navigation, after a form submission, or from a failure hook. The exact hook names and artifact directories vary by runner, so adapt the following pattern to your configuration.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteafterEach(async () => {
// Replace this condition with your runner's failure detection.
if (currentSpecFailed) {
await saveScreenshot(`failure-${Date.now()}.png`);
}
});
Do not let an optional diagnostic capture hide the original assertion. If taking the image fails, record that failure separately and preserve the primary test error. Also avoid starting a screenshot after a hook has already begun quitting the driver.
Viewport, frames and lazy content
Viewport-sized output
If the PNG contains only the visible viewport, that is consistent with Selenium’s documented fallback behavior. Confirm the output before labeling it a full-page artifact in a report. Changing the browser window size can alter what is visible, but it does not create a cross-browser guarantee of whole-document capture.
Rank #2
- FAST SPEEDS - Scans color and black and white documents a blazing speed up to 16ppm (1). Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
- ULTRA COMPACT – At less than 1 foot in length and only about 1. 5lbs in weight you can fit this device virtually anywhere (a bag, a purse, even a pocket).
- READY WHENEVER YOU ARE – The DS-640 mobile scanner is powered via an included micro USB 3. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan.
- WORKS YOUR WAY – Use the Brother free iPrint&Scan desktop app for scanning to multiple “Scan-to” destinations like PC, Network, cloud services, Email and OCR. (2) Supports Windows, Mac and Linux and TWAIN/WIA for PC/ICA for Mac/SANE drivers. (3)
- OPTIMIZE IMAGES AND TEXT – Automatic color detection/adjustment, image rotation (PC only), bleed through prevention/background removal, text enhancement, color drop to enhance scans. Software suite includes document management and OCR software. (4)
Frames
Selenium’s preference order refers to the current frame. If your test has switched into an iframe, the capture may represent that frame or the implementation’s chosen fallback. Switch to the intended browsing context before calling takeScreenshot(), then inspect the image rather than assuming that all frames were composited.
Lazy-loaded sections
Content that appears only after scrolling or another trigger may not be present when the screenshot is taken. Wait for the application’s own readiness condition and verify that the relevant content is rendered. The API documentation does not establish a universal scroll-and-stitch procedure for Protractor, so do not present one as guaranteed across drivers.
Choosing an approach for your requirement
| Approach | What you receive | When it fits | Important qualification |
|---|---|---|---|
browser.driver.takeScreenshot() |
Base64 PNG decoded to a local file | Diagnostics and artifacts inside an existing Protractor/WebDriver test | Full-page extent is implementation-dependent and must be checked |
| Same call from a failure hook | PNG associated with a failed test | Debugging regressions in local or CI runs | The hook must finish before driver teardown and should not replace the assertion error |
| Screenshot service | Image or PDF returned by an HTTP request | Capturing pages without maintaining browser setup in the test project | Use a service whose response and billing behavior match your operational needs |
Common problems and fixes
The file is empty or unreadable
Cause: The base64 string was written as ordinary text, or the write occurred before the promise resolved.
Fix: Pass 'base64' as the encoding to fs.writeFileSync, and await or return the takeScreenshot() promise. Open the resulting file rather than relying only on its existence.
Only the viewport appears
Cause: The installed browser or driver selected Selenium’s viewport fallback.
Fix: Confirm the behavior with the exact versions used by the suite, inspect the image height, and document that limitation in the report. The cited API behavior does not support claiming a universal Protractor switch for full-page output.
Rank #3
- FAST DOCUMENT SCANNING — Document scanner with feeder allows you to speed through stacks with a 50-sheet Auto Document Feeder (ADF); Efficient office scanner to help you scan more productively
- INTUITIVE, HIGH-SPEED SOFTWARE — Quickly scan with this desktop document scanner; Epson ScanSmart Software lets you easily preview scans, email files, upload to the cloud, and more; Plus, automatic file naming saves even more time
- SEAMLESS INTEGRATION — Easily incorporate your data into most document management software with the included TWAIN driver; Office document scanner integrates seamlessly with business workflows
- EASY SHARING — Duplex scanner allows you to scan straight to email or popular cloud storage2 services like Dropbox, Evernote, Google Drive, and OneDrive for simple storage and sharing
- SIMPLE FILE MANAGEMENT — Scanner allows the creation of searchable PDFs with Optical Character Recognition (OCR) and convert scans to editable Word or Excel files effortlessly; Designed for home and office document scanning
The screenshot is taken before the page is ready
Cause: Navigation returned before asynchronous rendering, lazy content or a test action completed.
Fix: Wait for a reliable application condition—such as a known element or state your test already uses—then call the screenshot method. Avoid arbitrary delays when a deterministic condition is available.
The test exits before the image is saved
Cause: The hook starts an asynchronous capture but does not return or await it, or teardown closes the session immediately.
Fix: Return the promise from a promise-based spec, or use await in an async spec and hook. Store the file before allowing the browser to quit.
Recommended Free Tools
CI cannot find the artifact
Cause: The file was written to a local working directory that the CI job does not collect, or parallel workers used colliding names.
Fix: Write to the directory configured for test artifacts, use names that include the spec or worker identity, and configure the CI job to upload that directory. Those paths are runner-specific rather than Protractor API settings.
Rank #4
- Scanner type: Document
- Connectivity technology: USB
- With Auto Scan Mode, the scanner automatically detects what you're scanning
- Digitize documents and images
The capture call throws after a browser crash or timeout
Cause: The WebDriver session is no longer usable, or page loading failed before a screenshot could be requested.
Fix: Preserve the original WebDriver error, record that no screenshot was available, and investigate the navigation or session failure. A screenshot call cannot recover a closed session.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Performance and reliability considerations
- Capture only when useful. Taking an image on every passing test increases disk usage and artifact-upload time. Failure-only hooks are usually more manageable.
- Use deterministic names. Include the test identity and, for parallel runs, a worker identifier so one result does not overwrite another.
- Check both local and CI output. Window size, browser mode and driver implementation can change the captured area.
- Keep binary handling binary. Do not parse or re-encode the PNG as JSON or UTF-8 text.
- Set retention deliberately. Screenshots can contain account data or tokens rendered by the application; apply the same access controls and retention period as other test artifacts.
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server. A single GET request can return a PNG, JPEG, WebP or PDF, which is useful when you need repeatable captures outside a Protractor session.
For a direct image request, see the ScreenshotNeo API documentation. This cURL example saves a WebP response:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The equivalent Python request is:
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)
In Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const fs = require('fs');
fs.writeFileSync('shot.webp', Buffer.from(await res.arrayBuffer()));
Why this can be simpler than maintaining a browser capture
- Before capture, ScreenshotNeo accepts the cookie or consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be turned off.
- Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits cost nothing. Each response identifies the page verdict and billing status with
X-Page-VerdictandX-Billedheaders. - An MCP server provides
take_screenshot,get_page_infoandcapture_pdftools for Claude, Cursor and other MCP clients. - Options include full-page capture with lazy images loaded, CSS-selector element capture, dark mode, device presets or custom viewports, retina scale, PDF paper and page controls, custom CSS and JavaScript, pre-capture clicks, hidden selectors, selector or network-idle waits, request and resource blocking, custom headers, cookies, user agents and Authorization, timezone and geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed image links, asynchronous jobs with signed webhooks, bulk capture for 100 URLs per call, a usage API and an OpenAPI specification.
Every feature is available on every plan. The Free plan includes 1,000 screenshots per month with no card; paid plans are Starter $5 for 3,000, Growth $15 for 15,000, Pro $39 for 60,000, Scale $99 for 250,000 and Business $249 for 1,000,000. Yearly billing provides two months free. Create a free ScreenshotNeo account to start without a card.
FAQ
Does Protractor have a separate full-page screenshot method?
The documented route is the wrapped WebDriver object, browser.driver.takeScreenshot(). The available API descriptions do not establish a Protractor-only option that guarantees full-page output across browsers.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Best Value
- OUR MOST ADVANCED SCANSNAP. Large touchscreen, fast 45ppm double-sided scanning, 100-sheet document feeder, Wi-Fi and USB connectivity, automatic optimizations, and support for cloud services. Upgraded replacement for the discontinued iX1600
- CUSTOMIZABLE. SHARABLE. Select personalized profiles from the touchscreen. Send to PC, Mac, mobile devices, and clouds. QUICK MENU lets you quickly scan-drag-drop to your favorite computer apps
- STABLE WIRELESS OR USB CONNECTION. Built-in Wi-Fi 6 for the fastest and most secure scanning. Connect to smart devices or cloud services without a computer. USB-C connection also available
- PHOTO AND DOCUMENT ORGANIZATION MADE EFFORTLESS. Easily manage, edit, and use scanned data from documents, receipts, photos, and business cards. Automatically optimize, name, and sort files
- AVOIDS PAPER JAMS AND DAMAGE. Features a brake roller system to feed paper smoothly, a multi-feed sensor that detects pages stuck together, and skew detection to prevent paper damage and data loss
What format does Selenium return?
The JavaScript screenshot method returns base64-encoded PNG data. Decode it when writing the file.
Can I use a JPEG filename for this method?
The documented return is PNG data, so use a .png filename unless you perform a separate, explicit image conversion.
Frequently Asked Questions
Does Protractor have a separate full-page screenshot method?
The documented route is the wrapped WebDriver object, browser.driver.takeScreenshot(). The available API descriptions do not establish a Protractor-only option that guarantees full-page output across browsers.
What format does Selenium return?
The JavaScript screenshot method returns base64-encoded PNG data. Decode it when writing the file.
Can I use a JPEG filename for this method?
The documented return is PNG data, so use a .png filename unless you perform a separate, explicit image conversion.
Quick Recap
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.

