To capture a Selenium screenshot of an HTML table with its intended web font, wait until the table is in its final state, await document.fonts.ready, and then screenshot the table element or the page. If a particular font family, weight, or glyph set is essential, explicitly request the matching face with document.fonts.load() and fail the test if it rejects. A page-load wait alone does not guarantee that a lazily used web font has loaded.
Why screenshots show fallback fonts
Browsers can defer fetching a web font until content actually needs it. Selenium may therefore finish navigation while the table still uses a fallback font, or before a later interaction causes the custom font to load. Different font metrics can alter column widths, wrapping, row heights, and the table’s overall appearance.
The CSS Font Loading API offers two useful gates. document.fonts.ready resolves after fonts currently used by the document have loaded and layout work has completed. For a specific face, document.fonts.load(font, text) requests matching fonts and resolves when they load; a failure rejects the promise. These are complementary checks, not a guarantee that every font declared by the page—or every character in every face—has loaded. See the FontFaceSet ready documentation, Document.fonts documentation, and the CSS Font Loading API overview.
Use this sequence for a reliable capture
- Navigate and wait for the real table state. Wait for the table element and any data, filtering, sorting, or UI transition that determines what should appear in the image. A navigation completion signal does not establish that the table is populated or that its font is ready.
- Set a suitable script timeout. Font requests can depend on the site’s network and loading behavior. Configure Selenium’s asynchronous script timeout to fit the test environment rather than relying on a short default.
- Request a required font face, if needed. Use the CSS font descriptor that matches the table’s style and representative text that covers the characters in the table. For example:
14px "Brand Sans". Await the request and let rejection fail or explicitly report a test failure. - Await current font and layout readiness. Wait for
document.fonts.readyafter the relevant content is present and any required font request completes. - Capture the right boundary. Use an element screenshot for a close crop of the table, or a page/window screenshot when a heading, legend, or surrounding context matters.
- Inspect the output in the target environment. Check font appearance, glyph coverage, clipping, overflow, viewport, and dynamic content. Driver behavior can vary.
Python example: wait for a table font and save its screenshot
This example uses Selenium Python APIs documented for WebElement screenshots and asynchronous browser scripts. Replace the URL, selector, font descriptor, and representative text with those for the site under test.
#1 Best Overall
- Integrated Video Conferencing Features: Full HD adjustable webcam, mic array and stereo speakers for video conferencing and online learning
- Display Specifications: 27-inch Full HD (1920 x 1080) frameless IPS panel with wide viewing angles for enhanced visual experience
- Extensive Connectivity Options: DisplayPort, HDMI, D-sub, USB (upstream for webcam), Audio in and Earphone jack for maximum flexibility
- Ergonomic Design: +35 -5 tilt, 180 swivel, 90 pivot and 150mm height adjustments for a comfortable viewing experience
- Eye Care Technology: TV Rheinland-certified Flicker-free and Low Blue Light technologies to ensure a comfortable viewing experience
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
URL = "https://example.com/report"
TABLE_SELECTOR = "table.results"
FONT = '14px "Brand Sans"'
FONT_TEXT = "Table header 0123"
options = webdriver.ChromeOptions()
# Add your environment's normal headless or browser options here.
driver = webdriver.Chrome(options=options)
try:
driver.set_script_timeout(30)
driver.get(URL)
# Wait for the table to exist. Add an application-specific condition if
# rows or data load asynchronously after the element appears.
table = WebDriverWait(driver, 20).until(
EC.presence_of_element_located((By.CSS_SELECTOR, TABLE_SELECTOR))
)
# Explicitly request the face used by the table. A rejected promise
# surfaces a failed font precondition instead of silently passing.
driver.execute_async_script("""
const done = arguments[arguments.length - 1];
document.fonts.load(arguments[0], arguments[1])
.then(() => document.fonts.ready)
.then(() => done(true), error => done({error: String(error)}));
""", FONT, FONT_TEXT)
# Re-find after any application transition that might replace the element.
table = driver.find_element(By.CSS_SELECTOR, TABLE_SELECTOR)
table.screenshot("table.png")
finally:
driver.quit()
Selenium’s Python WebElement screenshot API saves a PNG at the supplied path; its documentation also describes returning screenshot data. See Selenium’s WebElement documentation. The Java API exposes screenshot support through TakesScreenshot; consult the Selenium Java API reference for that binding and driver. Selenium’s Python WebDriver screenshot methods are documented at the WebDriver API reference.
Minimal font-readiness wait
If the table’s normal CSS use is enough to trigger the required font, a simpler asynchronous wait is:
driver.set_script_timeout(30)
driver.execute_async_script("""
const done = arguments[arguments.length - 1];
document.fonts.ready.then(() => done(true), done);
""")
The explicit family request is more diagnostic when a particular face matters. In either case, first put the page into its final table state. If an interaction or later content change triggers new font loads, wait again after that change.
Rank #2
- Versatile Full HD IPS Display: Elevate your home office or study space with this 32 Inch 1080p (1920 x 1080) LED monitor; enjoy an IPS panel that delivers consistent colors and wide viewing angles for clear visuals from any perspective
- Smooth Adaptive Sync Performance: Enjoy fluid visuals for casual gaming and multimedia with VESA Adaptive Sync technology; this feature enables a smooth 75Hz refresh rate to ensure consistent frame rates and reduced screen tearing for a seamless experience
- Enhanced Viewing Comfort: Minimize eye fatigue during long workdays or study sessions with integrated Flicker-Free technology and a Blue Light Filter; these eye care features provide a more comfortable viewing experience for students and professionals
- Tailored ViewMode Settings: Optimize screen performance with ViewSonic exclusive ViewMode presets; quickly switch between “Game,” “Movie,” “Web,” “Text,” and “Mono” modes to get the ideal gamma curve, contrast, and brightness for any task or application
- Flexible Connectivity: Seamlessly connect your laptops, PCs, and Macs with versatile input options; this monitor features HDMI and VGA inputs, providing the reliable compatibility needed for both modern hardware and legacy devices in any setup
Choosing an element or page screenshot
| What the image should include | Capture choice | What to verify |
|---|---|---|
| One table, closely cropped | WebElement screenshot | Check clipping, table overflow, scrollable containers, and driver support. |
| Table with heading, legend, or page context | Page or window screenshot | Use a consistent viewport and position the content. A window screenshot is not automatically a full-document capture in every implementation. |
| Consistent results across browsers | Test the exact browser, driver, Selenium version, viewport, and operating environment | Do not assume one driver’s behavior applies to all. Selenium’s Java reference labels non-W3C screenshot behavior best effort. |
For screenshots whose boundaries matter, define the capture target deliberately. Element capture is convenient, but a table can extend beyond its visible scroll container; page capture may preserve context while capturing only the current window area. The actual result depends on the browser and driver implementation.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Make the font check specific enough
Match the table’s actual face
A CSS font descriptor includes size and family, and may include weight or style when those variants matter. For a bold header, for example, request a descriptor corresponding to the header’s real CSS styling rather than assuming a normal-weight face proves the bold face is ready. The page’s computed styles can help confirm the requested family and weight.
Use representative characters
The text argument to document.fonts.load() helps select fonts needed for that text. Include representative letters, numerals, punctuation, and other scripts or symbols used in the table. Loading a matching face is not certification that every glyph exists in the font; missing glyphs may still be rendered using fallback fonts.
Rank #3
- VIVID COLORS: Experience stunning colors across the entire display with the IPS panel. Colors remain bright and clear across the screen, even when you change angles. Tones and shades are represented consistently and beautifully with less color washing.
- SMOOTH PERFORMANCE: 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 a competitive edge with optimizable game settings. Color and image contrast can be instantly adjusted to see scenes more clearly, while Game Mode adjusts any game to fill your screen with every detail in view.
- EASY ON THE EYES: Protect your vision and stay comfortable, even during long sessions. Stay focused on your work with reduced blue light and screen flicker.²
- A MODERN AESTHETIC: Featuring a super-slim design with ultra-thin border bezels, this monitor enhances any setup with a sleek, modern look. Enjoy a lightweight and stylish addition to any environment.
Check status and failures
The document font set exposes face status and loading errors. If the requested font promise rejects, treat it as a failed precondition and investigate rather than saving a screenshot that appears superficially complete. A ready promise concerns fonts and layout work currently relevant to the document, not every declared but unused face.
Troubleshooting
- The screenshot uses a fallback font. Inspect the table’s computed family and weight, the relevant font-face status, and the browser’s font network responses. Confirm that the requested glyphs are covered. Explicitly call
document.fonts.load()for the correct face and text, and handle rejection. See FontFaceSet.load(). - The page reports loaded, but the screenshot is still wrong. Navigation readiness and font readiness are separate. Wait until the table has its intended data and state, then await fonts and layout. Fonts can be fetched only when first needed.
- The table image is clipped or incomplete. Check whether the table is inside an overflow or scroll container and compare element capture with a page capture. Verify the behavior in the exact browser and driver combination.
- The result is intermittent. Replace arbitrary sleeps with explicit waits for the final table state and font promises. If the application changes the table or triggers font use after the first wait, await readiness again before capture.
- The font load promise rejects. Investigate the font URL, CSS face declaration, requested weight or style, cross-origin access configuration, and browser network availability. The Font Loading API reports failed loading rather than making a failed request equivalent to a successful font.
- The wrong element or old content is captured. An application may replace a table during rendering. Wait for the final condition, then locate the element again immediately before screenshotting.
Performance, repeatability, and test cost
Font waits add only the time needed for the relevant font and layout work to settle; a fixed delay can waste time on fast runs yet still be too short on slow ones. Avoid capturing immediately after an interaction merely because the click returned. Make the final-state condition explicit, request only the face and representative text your test needs, and keep browser, driver, Selenium version, viewport, and operating environment consistent when comparing screenshots.
The documentation establishes the APIs and their semantics, not a universal timing guarantee or cross-driver image match. Treat visual inspection or image assertions in your own target environment as part of validating the workflow, particularly when the test depends on exact crop boundaries or typography.
Rank #4
- Complete Video Conferencing Solution: Ready for telecommuting and online learning with integrated 2MP adjustable Full HD webcam, mic array and stereo speakers for seamless communication
- Display Specifications: Aspect Ratio is 16:9 with Viewing Angle (CR10) of 178/ 178 and Brightness (Typ) of 300cd/ for consistent visibility from multiple positions
- Full HD Frameless Display: 24-inch 16:9 Full HD (1920 x 1080) frameless IPS panel with wide viewing angles for immersive visual experience
- Advanced Audio Technology: Beamforming and echo cancellation technology to filter out ambient noise including keyboard clicks and to further enhance speech clarity during calls
- Eye Care Technology: ASUS Eye Care Technology with TV Rheinland Certification for Flicker-free and Low Blue Light technology to reduce eye fatigue associated with extended viewing
Or skip the browser setup
For a screenshot from a URL without managing Selenium and a browser driver, ScreenshotNeo offers a website screenshot API and MCP server. A basic GET request returns an image or PDF. For example, save a rendered page as WebP:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/report -o shot.webp
See the ScreenshotNeo API documentation for request options. ScreenshotNeo removes cookie/consent banners, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, with response headers identifying the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents and MCP clients. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots. ScreenshotNeo captures a URL, so this is an alternative when a rendered page capture meets the need—not a replacement for Selenium tests that must exercise a specific browser session or application state.
Sign up for ScreenshotNeo free: 1,000 screenshots a month, no card required.
Free tools Windows power users keep installed
One-click scans. No signup required.
Frequently Asked Questions
Does document.fonts.ready load every font declared in the page?
No. It concerns fonts used by the document and current font/layout work; declared but unused faces may remain unloaded.
Best Value
- VIVID COLORS: Experience stunning colors across the entire display with the IPS panel. Colors remain bright and clear across the screen, even when you change angles. Tones and shades are represented consistently and beautifully with less color washing.
- SMOOTH PERFORMANCE: 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 a competitive edge with optimizable game settings. Color and image contrast can be instantly adjusted to see scenes more clearly, while Game Mode adjusts any game to fill your screen with every detail in view.
- EASY ON THE EYES: Protect your vision and stay comfortable, even during long sessions. Stay focused on your work with reduced blue light and screen flicker.²
- A MODERN AESTHETIC: Featuring a super-slim design with ultra-thin border bezels, this monitor enhances any setup with a sleek, modern look. Enjoy a lightweight and stylish addition to any environment.
Can document.fonts.load() prove that every table character uses the custom font?
No. It requests matching faces for the supplied text; it does not certify coverage for every glyph.
Will Selenium’s element screenshot always capture the full table?
Not necessarily. Overflow, scroll containers, and driver implementation can affect the captured result; check it in the target environment.
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.

