Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsSafariDriver’s standard screenshot captures only the visible browser viewport, not an entire long page. To create a full-page image while automating Safari with Java, capture successive viewport screenshots as you scroll, then stitch them together. Keep sticky headers and floating controls in the first frame and hide or mask them in later frames if you do not want them repeated. The exact result depends on the page and Safari environment; the cited documentation does not provide a universal sticky-element recipe or a tested Java stitching implementation.
What SafariDriver captures—and what it does not
Apple supports Safari WebDriver through Selenium-compatible client libraries, including Java (Apple’s Safari WebDriver documentation). Selenium provides SafariDriver and the TakesScreenshot interface for saving screenshots, but the WebDriver screenshot command captures the top-level browsing context’s initial viewport—not all content in the document (W3C WebDriver specification; Selenium TakesScreenshot API).
That distinction matters on long pages: a successful PNG from getScreenshotAs can still be incomplete. For Safari itself, the practical approach is to scroll, capture multiple viewports, and assemble those images in order. The screenshots overlap or meet at seams, so plan how to remove duplicated pixels and how to treat fixed or sticky elements.
Set up Selenium to automate Safari
Safari’s WebDriver executable, safaridriver, is supplied with macOS. Selenium’s Safari guidance shows Java setup with SafariOptions and SafariDriver; it also documents enabling the driver with safaridriver --enable (Selenium SafariDriver guide). Follow the current Apple and Selenium guidance for your macOS, Safari, and Selenium versions, and record those versions when you need repeatable results.
- On the Mac that will run the test, enable SafariDriver in a terminal:
safaridriver --enable. Follow any operating-system prompts. - Add Selenium’s Java client library to your project using your normal dependency-management setup. Use the version supported by your project and consult the current SafariDriver guide.
- Start a
SafariDriversession usingSafariOptions, navigate to the target page, and wait for the content you need to capture. - Use Selenium’s
TakesScreenshotAPI for each viewport image. It is a viewport-capture step, not a built-in full-document screenshot.
Full-page capture with scroll-and-stitch
The following Java example demonstrates the core strategy: take a viewport screenshot at each scroll position and draw the resulting images into a taller PNG. It uses Java’s standard image APIs for assembly. It is a starting point, not a universal solution: page height can change as content loads, and sticky overlays, nested scrolling containers, device-pixel scaling, animations, and overlap alignment can require page-specific adjustments.
The code assumes Selenium Java is on the classpath. Save it as SafariFullPageScreenshot.java, compile it with the Selenium dependencies available, and run it on a Mac with SafariDriver enabled. Replace the sample URL and output path. The example uses the browser’s reported viewport size to determine capture steps and crops each image to the remaining document height; inspect the result and tune it for your target page.
import org.openqa.selenium.Dimension;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.safari.SafariDriver;
import org.openqa.selenium.safari.SafariOptions;
import javax.imageio.ImageIO;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class SafariFullPageScreenshot {
public static void main(String[] args) throws Exception {
SafariOptions options = new SafariOptions();
WebDriver driver = new SafariDriver(options);
try {
driver.manage().window().setSize(new Dimension(1280, 900));
driver.get("https://example.com");
JavascriptExecutor js = (JavascriptExecutor) driver;
// Replace this basic readiness check with a wait for the page content you need.
Thread.sleep(1500);
List<BufferedImage> frames = new ArrayList<>();
List<Integer> offsets = new ArrayList<>();
int viewportHeight = ((Number) js.executeScript(
"return window.innerHeight")).intValue();
int documentHeight = ((Number) js.executeScript(
"return Math.max(document.body.scrollHeight, " +
"document.documentElement.scrollHeight)")).intValue();
for (int y = 0; y < documentHeight; y += viewportHeight) {
js.executeScript("window.scrollTo(0, arguments[0])", y);
Thread.sleep(300); // Allow scrolling and layout to settle.
byte[] png = ((TakesScreenshot) driver)
.getScreenshotAs(OutputType.BYTES);
frames.add(ImageIO.read(new java.io.ByteArrayInputStream(png)));
offsets.add(y);
// Recheck height: lazy content may have extended the page.
documentHeight = ((Number) js.executeScript(
"return Math.max(document.body.scrollHeight, " +
"document.documentElement.scrollHeight)")).intValue();
}
BufferedImage first = frames.get(0);
double scaleX = (double) first.getWidth() /
((Number) js.executeScript("return window.innerWidth")).intValue();
double scaleY = (double) first.getHeight() / viewportHeight;
int outputWidth = first.getWidth();
int outputHeight = (int) Math.ceil(documentHeight * scaleY);
BufferedImage full = new BufferedImage(
outputWidth, outputHeight, BufferedImage.TYPE_INT_RGB);
Graphics2D g = full.createGraphics();
for (int i = 0; i < frames.size(); i++) {
BufferedImage frame = frames.get(i);
int destY = (int) Math.round(offsets.get(i) * scaleY);
int remaining = outputHeight - destY;
int copyHeight = Math.min(frame.getHeight(), remaining);
if (copyHeight > 0) {
g.drawImage(frame, 0, destY, outputWidth,
destY + copyHeight, 0, 0, frame.getWidth(),
copyHeight, null);
}
}
g.dispose();
ImageIO.write(full, "png", new File("full-page.png"));
} finally {
driver.quit();
}
}
}
The simple placement in this example draws each frame at its scroll offset. Since adjacent viewport captures overlap by the amount the page scrolls and the viewport height, later frames overwrite earlier pixels in those regions. That can create visible seams when content moves or sticky elements behave differently at the boundary. A more controlled stitcher can use a fixed overlap and crop the repeated band from each later frame before drawing it. Keep crop measurements in screenshot pixels: Safari’s screenshot pixel dimensions may differ from CSS viewport dimensions, so derive the scale from the image and viewport rather than assuming one image pixel equals one CSS pixel.
Choose a policy for sticky and fixed elements
Before capturing, decide whether a sticky header should appear once, repeat as it would during scrolling, or be absent from the final image. For a clean document image, a common policy is to retain the element in the first frame and hide or mask it for subsequent frames. WebdriverIO documents a related mitigation—hiding chosen elements after the first scroll—but that is evidence of a useful pattern, not a Java or Safari guarantee (WebdriverIO method options).
Crashes, 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 minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11If you temporarily change page styles with JavaScript, do so only after the first capture, save the original inline styles or class state, and restore them before ending the session. Hiding a broad selector such as header can also remove non-sticky content; prefer a selector verified for the specific page. Some sites use shadow DOM, nested scrolling, or script-controlled overlays, so a simple CSS selector may not reach the element you intend.
Handle lazy loading and changing page height
A page may load images or append content only after you scroll near it. Capture after each scroll has settled, and recheck document height rather than relying exclusively on a value measured before the first frame. For pages that continue extending, use a maximum scroll count or a timeout in your production code so an endlessly growing page cannot make the job run indefinitely. Wait for a relevant selector or known content state where possible; a fixed sleep is only a basic example and may be too short or unnecessarily long.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Review the output instead of assuming it is complete
- Check the top and bottom edges for missing content, clipped sections, or blank extra space.
- Inspect every join for duplicated text, gaps, or a visible horizontal band.
- Look for repeated sticky headers, cookie banners, chat controls, or floating buttons.
- Confirm lazy images have loaded and that animations or changing counters have not made sections inconsistent.
- Re-run against the same Safari and macOS versions when investigating a difference; the cited sources do not establish one universal result across sites and versions.
Why element screenshots are not a substitute
Selenium’s element screenshot command captures an element’s visible region after scrolling it into view; it does not turn the whole document into one image. Use it when the target is a visible component, such as a chart or card, rather than a page-length result. For a full-page image in actual Safari, scroll-and-stitch remains the approach described here.
Alternative: Playwright Java full-page capture
Playwright Java documents a full-page screenshot option in its screenshot API (Playwright Java screenshots). That option may reduce the need to implement stitching, but the cited documentation does not establish that it uses Safari’s installed safaridriver. If the requirement is specifically Safari’s browser engine and WebDriver, do not treat Playwright’s full-page option as interchangeable without confirming the browser and rendering engine you need.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Or skip the browser setup
ScreenshotNeo provides a screenshot API: one GET request with a URL returns a PNG, JPEG, WebP, or PDF. For a quick capture, use the request below; see the ScreenshotNeo API documentation for options. This is a service-based capture rather than a SafariDriver session, so use SafariDriver when your requirement is specifically to automate Safari.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
ScreenshotNeo accepts cookie or consent banners before capture 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 are not billed, and the response says which outcome occurred. An MCP server gives AI agents tools for screenshots, page information, and PDF capture. The free plan includes 1,000 screenshots a month without a card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Troubleshooting
SafariDriver does not start
Confirm you are running the Java test on macOS with Safari available, enable the driver with safaridriver --enable, and follow any macOS prompts. Check the current Selenium Safari guide for version-specific setup rather than assuming a setup step from another browser applies.
Free tools Windows power users keep installed
One-click scans. No signup required.
The image contains only the first screen
That is expected if the code captures once and saves the result. TakesScreenshot.getScreenshotAs produces a viewport screenshot under the WebDriver screenshot command. Scroll and capture multiple viewports, then assemble them.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
The result has repeated or missing bands
Compare the scroll offsets with the screenshot pixel height. CSS pixels and image pixels may not match; calculate the scale from the image dimensions and the CSS viewport. Adjust the overlap/crop logic and inspect the seam after each change. Sticky elements can also change position between captures.
Content is blank or incomplete farther down
Scroll to trigger lazy loading, wait for the relevant content to appear, and recalculate document height after the page settles. If the page uses a nested scrolling container, scrolling window will not expose its contents; identify and scroll the actual container.
The capture never finishes
Some pages continuously append content or change height. Bound the number of scrolls or the total capture time, and define which portion of the page is in scope. Do not let a changing document height alone control an unbounded loop.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Frequently Asked Questions
Can Selenium’s SafariDriver take a full-page screenshot in one call?
The WebDriver screenshot command captures the top-level browsing context’s initial viewport. Use multiple captures and stitch them for the SafariDriver workflow described here.
Will Playwright’s full-page option capture Safari?
The cited Playwright Java screenshot documentation describes full-page capture but does not establish use of Safari’s installed safaridriver. Confirm the browser engine requirement before substituting 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.

