Use a browser automation tool to read the page title after it loads, sanitize that text for your filesystem, and pass the resulting path to the screenshot command. With Playwright, page.title() reads the title and page.screenshot({ path, fullPage: true }) saves a full-page image. Add a date or other unique identifier to avoid overwriting captures with the same title.
Save a screenshot using the page title with Playwright
Playwright lets you choose the screenshot path, but it does not automatically turn the page title into a filename. Read the title in your script, make it safe for filenames, then call the screenshot method. The example below uses JavaScript and saves a full-page PNG with the capture date.
As an Amazon Associate I earn from qualifying purchases.
Install Playwright and its browser before running the script; see the Playwright Page API and Playwright Screenshots documentation for the documented title and screenshot methods.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
const page = await browser.newPage();
const url = 'https://example.com';
try {
await page.goto(url, { waitUntil: 'domcontentloaded' });
const title = await page.title();
const safeTitle = title
.normalize('NFKC')
.replace(/[\/:*?"<>|u0000-u001F]/g, '-')
.replace(/s+/g, ' ')
.trim()
.replace(/[. ]+$/g, '')
.slice(0, 120) || 'untitled-page';
const date = new Date().toISOString().slice(0, 10);
const filename = `${safeTitle}-${date}.png`;
await page.screenshot({ path: filename, fullPage: true });
console.log(`Saved ${filename} from ${url}`);
} finally {
await browser.close();
}
})();
The 120-character limit and replacement rules here are practical choices, not Playwright requirements. A filesystem limits the encoded filename and the full path, so an unusually long title or directory path may still need a shorter limit. The date suffix distinguishes captures made on different days, but not multiple captures of the same title on one day.
#1 Best Overall
- CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
- WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
- A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
Choose what the screenshot should preserve
Viewport or full page
With fullPage: true, Playwright captures the full scrollable page; omit it to capture the current viewport. Full-page images can be very tall. If the useful record is a particular screen state, use a viewport capture or capture a specific element rather than producing a long image. Playwright documents page and element screenshots in its screenshots guide.
Wait for title changes when necessary
Some sites update the document title after client-side rendering. If the title is initially blank or generic, wait for the site’s relevant content or title update before calling page.title(). Choose a condition that indicates the page is ready; a fixed delay can work for a known site but is less reliable when load times vary.
Make archive filenames dependable
- Sanitize: Replace characters disallowed by the target filesystem, collapse whitespace, and trim trailing periods or spaces. The example uses hyphens for characters that commonly cause path problems.
- Handle empty titles: Use a fallback such as
untitled-pagerather than creating an empty filename. - Prevent collisions: Add a timestamp, stable ID, or sequence number if repeated captures can share a title and date. Do not silently overwrite an earlier image.
- Keep provenance: Store the original URL, capture time, title, and relevant viewport or capture settings in an index file alongside the images. A page title can be duplicated, misleading, or changed later.
- Consider filesystem limits: Truncate the title portion conservatively, and account for the file extension and directory path as well as the title.
Other ways to save a title-named screenshot
| Option | How naming works | Full-page capture | When it fits |
|---|---|---|---|
| Playwright script | Read the title in code, sanitize it, and pass a computed path. | Supported with fullPage: true. |
Best when naming must be automatic or part of a repeatable workflow. |
| Playwright CLI | Accepts --filename=<f>; derive the title in a script or another step and supply that filename. |
Supported with --full-page. |
Useful when you want command-line capture but do not need title extraction entirely within the CLI. |
| shot-scraper | Accepts -o to choose an output filename; title-derived naming requires an external step to read and transform the title. |
Its Release 1.3 documentation says omitting height produces a full-page screenshot. | Useful for command-line capture workflows. Its documentation also describes following redirects and saving rendered HTML. |
The Playwright CLI documentation says its default filename includes a timestamp when --filename is omitted. The shot-scraper Release 1.3 documentation covers output paths and full-page behavior. For either command-line option, dynamically naming a file from the page title requires a script or another step to fetch and sanitize that title first.
Rank #2
- CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
- SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
What a screenshot archive does—and does not—contain
A screenshot is a visual record of a page as rendered at capture time. It does not, by itself, preserve the page’s source text, links, scripts, network resources, or interactive behavior. A title-based filename helps organize images but is not enough to establish where or when an image came from; retain the URL and timestamp as metadata.
shot-scraper’s cited documentation describes saving final rendered HTML after JavaScript runs, but does not establish that this output is a complete, replayable website archive. If the goal is future reconstruction or replay, use a purpose-built web archiving workflow and keep the screenshot as a visual companion.
Troubleshoot common naming and capture problems
The filename is blank or unhelpful
The document title may be empty, generic, or not yet updated by client-side code. Wait for the relevant page state, then read the title; preserve the source URL in metadata and use a fallback filename if the title remains empty.
Rank #3
- Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
- Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
- Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
- In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
- Ultra-thin bezels: Maximize your viewing experience with thin bezels.
Captures overwrite one another
Two pages can share a title, and repeated captures can occur on the same day. Add a time, unique ID, or counter and ensure your saving process does not overwrite existing files silently.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsThe path is rejected or too long
Replace filesystem-sensitive characters, trim trailing periods and spaces, and shorten the title further. Also check the directory path and encoded filename length; a title-only character count does not account for both.
The screenshot misses content
A viewport screenshot includes only what is visible in the current viewport. Enable full-page capture when the whole scrollable page is needed, and wait for the page’s content to render before capturing.
Rank #4
- CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
- SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
- MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
- KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
- INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
The image cannot recreate the original page
That is expected: a screenshot preserves appearance, not the underlying interactive site. Save appropriate metadata and use a separate archiving method when replay or preservation of page resources is required.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
ScreenshotNeo can return a screenshot from one GET request, with PNG, JPEG, WebP, or PDF output. It does not document automatic filename creation from a page title, so use the response in your own naming workflow if that is required. Its documented clean-shot steps accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report page verdict and billing status. It also offers an MCP server with screenshot, page-info, and PDF tools for AI agents.
Example cURL call, based on the ScreenshotNeo documentation:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The filename in this example is fixed as shot.webp; to name files from page titles, obtain the title separately and apply the sanitization and collision handling described above. ScreenshotNeo’s free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for 1,000 free screenshots a month, with no card required.
Best Value
- 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
- 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
- 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Frequently Asked Questions
Does a title-based filename prove when or where a screenshot was taken?
No. Keep the source URL and capture timestamp in metadata alongside the image.
Can I use a page title with the Playwright CLI alone?
The CLI accepts a filename, but title-derived naming requires a script or another step to read and sanitize the title first.
Is a screenshot a complete website archive?
No. It records appearance, not the page’s underlying content and behavior or all resources needed to replay it.
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.




