How to Capture a Full-Page Screenshot with Selenium WebDriver 3.0
Capture a screenshot with Selenium 3, save it to disk, and check whether your browser driver included the whole page. Full-page capture depends on the driver.

Short answer: Selenium WebDriver 3 can request a screenshot through the TakesScreenshot interface, but a normal screenshot call does not guarantee a full-document image. In Java, call getScreenshotAs(OutputType.FILE), save the returned file, and inspect the result. The Selenium 3.141.59 API describes the extent as a browser-and-driver-dependent best effort: it may be the entire page, the current window, the visible part of a frame, or the display. See the Selenium Java API reference.
This guide uses Java because the Selenium 3.141.59 reference specifically documents that binding and method. The same portability warning applies when choosing another binding: verify the API supported by your Selenium, browser, and driver versions rather than assuming a cross-browser full-page option exists.
1. What “full-page” means in Selenium 3
A viewport screenshot records what is visible in the browser at one moment. A full-page screenshot records the document beyond the current viewport as well. WebDriver’s screenshot interface does not promise that every implementation will produce the latter. The Selenium 3 Java API calls screenshot capture a best effort and describes a preferred extent, starting with the entire page, then the current window, the visible portion of the current frame, and finally the complete display.
That preference is not a switch that forces every driver to capture the whole document. The browser and driver determine what the call returns. Two machines running the same Java code can therefore produce images with different coverage if their browser/driver implementations differ. Treat “full-page” as something to verify in your environment, not an assumption based on a successful method call.
The direct API reference below is for Java Selenium 3.141.59. Selenium 4 documentation and current browser-specific APIs may offer other methods, but those are not evidence that an equivalent convenience exists in every Selenium 3 binding or setup.
2. Set up Selenium 3 and capture a screenshot in Java
The example uses Maven, Chrome, and Selenium 3.141.59. It opens a page, waits for the document’s ready state, takes the WebDriver screenshot, and copies it to a known destination. You need a compatible Chrome and ChromeDriver available to your environment; driver setup is specific to how your project installs and locates browser drivers.

Maven dependency
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
Runnable Java example
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Duration;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
public class Selenium3Screenshot {
public static void main(String[] args) throws Exception {
WebDriver driver = new ChromeDriver();
Path output = Paths.get("artifacts", "page.png");
try {
driver.manage().timeouts().pageLoadTimeout(Duration.ofSeconds(45));
driver.get("https://example.com");
new WebDriverWait(driver, 20).until(d ->
"complete".equals(((JavascriptExecutor) d)
.executeScript("return document.readyState"))
);
File screenshot = ((TakesScreenshot) driver)
.getScreenshotAs(OutputType.FILE);
Files.createDirectories(output.getParent());
Files.copy(screenshot.toPath(), output);
System.out.println("Saved screenshot to " + output.toAbsolutePath());
} finally {
driver.quit();
}
}
}
The important Selenium 3 call is the cast to TakesScreenshot followed by getScreenshotAs(OutputType.FILE). The returned temporary file is copied to the output path before the browser session ends. The example waits for the document load event, which helps avoid capturing the initial navigation state; it does not guarantee that client-side rendering, images, fonts, or lazy-loaded content have finished.
Run and verify
- Confirm that Java, Maven, Chrome, and a compatible ChromeDriver are available.
- Put the dependency and class in a Maven project, then run the class from your IDE or configure its execution in your build.
- Open
artifacts/page.pngand check the bottom of the document, not just the file’s existence. - Compare the image height with the page’s document height when diagnosing a viewport-only result. A successful WebDriver call confirms that an image was returned; it does not prove full-page coverage.
3. Wait for the content you actually need
document.readyState === "complete" is a useful navigation checkpoint, but many pages continue work after it becomes complete. A single-page application may fetch data later; an image may load only when it approaches the viewport; a font or animation may still be changing the layout. Decide which content defines a ready capture and wait for that condition explicitly.
Wait for a page-specific element
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
new WebDriverWait(driver, 20).until(
ExpectedConditions.visibilityOfElementLocated(By.cssSelector("main article"))
);
Replace the selector with an element that indicates the page content is ready. If content is added after that element appears, wait for the relevant result or state change as well. Avoid arbitrary long sleeps as the only synchronization method: they waste time on fast runs and can still be too short on slow ones.
Lazy loading and long pages
Lazy-loaded media may not exist in the document until the page is scrolled. If the screenshot implementation captures the document without triggering those loads, lower sections can be empty or incomplete. A controlled scroll through the page can prompt some sites to load content, but behavior varies by site, and scrolling does not turn a viewport screenshot API into a guaranteed full-page capture. Allow the page to settle after scrolling, then inspect the result.
Long documents can also include sticky headers, fixed banners, animations, or content that changes position as the browser scrolls. A stitched image made from viewport captures can show repeated sticky elements, gaps, overlaps, or seams where the layout changed. If you use a scroll-and-stitch workaround, treat it as an application-specific approach: check every seam, wait for layout stability, and test pages with fixed-position elements. The sources for this guide do not establish a universal Selenium 3 recipe that reliably stitches every browser page.
4. Check the result and choose a fallback
Open the output and confirm that its bottom corresponds to the page’s actual end. You can also compare dimensions with browser-side document measurements, but dimensions alone are not proof: a tall image might still omit content, and a page may have a different layout at the chosen viewport.
Object dimensions = ((JavascriptExecutor) driver).executeScript(
"return { width: document.documentElement.scrollWidth, " +
"height: document.documentElement.scrollHeight };"
);
System.out.println("Document dimensions: " + dimensions);
If the image only shows the window, first confirm the browser and driver versions and consult documentation for that exact combination. Some browser-specific or newer Selenium features may capture a full document, but do not copy a Selenium 4 method into a Selenium 3 project without checking whether the binding provides it. If no supported full-page mechanism exists for your setup, use a carefully validated browser-specific method or a scroll-and-stitch workflow that fits your page and test it against representative layouts.
5. Configuration, formats, and practical limits
The Selenium 3 Java API exposes output types through OutputType, including a file result as shown here. Choose the file output when you want to copy an image directly, or use the binding’s supported byte or Base64 output when your application needs to store or transmit the result differently. Do not infer image format from the filename alone; check the bytes and the behavior of the browser/driver implementation you use.
- Viewport: Set window dimensions before navigation or capture when consistent layout matters. Responsive pages may rearrange, hide, or load different content at different widths.
- Wait strategy: Use page-load timeouts for navigation and explicit waits for application-specific readiness. A timeout does not make a page render successfully.
- Browser and driver: Record their versions with the Selenium version in CI. Screenshot extent and rendering can depend on this combination.
- Output path: Create parent directories and use an explicit path. Preserve artifacts on failure when debugging, but close the browser reliably.
- Page state: Authentication, consent dialogs, geolocation, locale, and test data can alter the captured page. Configure these as part of the browser session when your test requires them.
- Privacy: Screenshots can contain personal data, account details, or secrets rendered on the page. Store and share artifacts under the same controls as other test data.
6. Troubleshooting common failures
| Symptom | Likely cause | What to try |
|---|---|---|
| Image contains only the visible window | The browser/driver returned a viewport-sized screenshot; full-page capture is not guaranteed. | Check image coverage, then use a full-document method documented for that exact browser, driver, and Selenium version. |
| Bottom sections are blank or images are missing | Lazy content has not loaded, or capture happened before rendering settled. | Wait for page-specific content, trigger lazy loading if appropriate, and verify the result after the page settles. |
| Screenshot call throws an unsupported-operation error | The active driver does not implement the screenshot interface as expected, or the wrong driver is being used. | Confirm the concrete driver and version, and check the Selenium 3 API documentation for that binding. |
| File not found after capture | The output directory was not created, or the code copied to a different working directory. | Create parent directories and print the absolute output path, as the Java example does. |
| Driver or browser fails to start | Browser and driver versions are incompatible, or the driver executable is unavailable. | Install a compatible pair and ensure the driver is discoverable by your environment. |
| Screenshot is taken before the page is ready | Navigation completion happened before application content or asynchronous assets settled. | Wait for a meaningful selector or state change; use a bounded timeout and report a useful failure when it expires. |
| Image has seams or repeated headers | A manual scroll-and-stitch process captured fixed elements in multiple viewport images. | Use a browser-supported full-page capture when available, or account for fixed elements and inspect every stitched boundary. |
7. Performance, reliability, and cost
Screenshot capture adds browser work to an automation run. Very long pages can take more time to render and produce larger image files; waiting for every network request to stop is not always a reliable readiness test because analytics and long-lived requests may remain active. Prefer a condition tied to the content under test and keep timeouts bounded.
For reliable CI output, pin or record Selenium, browser, and driver versions; use a predictable viewport; capture only after the page-specific readiness condition; and retain representative artifacts when investigating failures. Recheck screenshot dimensions and visual coverage after changing any of those components. A successful run on one browser version does not establish identical output on another.
Running Selenium yourself has no per-screenshot API charge, but it uses compute and maintenance time for browser setup, driver compatibility, retries, artifact storage, and any custom full-page handling. The relevant cost is your infrastructure and engineering effort; this guide makes no benchmark or cost comparison. If you need a hosted capture path, compare its behavior and billing rules against your requirements rather than assuming it matches WebDriver.
8. Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server from Yorker Media. One GET request can return a PNG, JPEG, WebP, or PDF. For a Selenium-style screenshot task, start with the API’s documented parameters and response behavior in the ScreenshotNeo docs.

curl -G "https://api.screenshotneo.com/v1/shot" \
-d access_key=YOUR_API_KEY \
--data-urlencode url=https://example.com \
-o shot.webp
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://example.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://example.com'
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
await Bun.write('shot.webp', res);
ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before the shot. Bot checks, blank pages, and failed loads are never billed; response headers say the page verdict and billing status. Its MCP server lets AI agents use take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. Start with 1,000 free screenshots a month, no card required.
9. Frequently asked questions
Does Selenium 3 guarantee a full-page screenshot?
No. The Selenium 3 Java API describes screenshot extent as best effort and dependent on the driver and browser implementation. Verify the saved output.
Can I use a Selenium 4 full-page method in a Selenium 3 project?
Do not assume so. Check the method against the exact Selenium 3 language binding and browser-driver combination in your project.
Why does the screenshot omit a page section even though navigation succeeded?
Navigation completion and application readiness are different. The section may be rendered asynchronously or loaded only after scrolling.
Is scroll-and-stitch a universal workaround?
No. It can fail around fixed elements, changing layouts, and lazy content. Validate it against the pages you capture.
Should I use Selenium or a screenshot API?
Use Selenium when the browser session and interactions are part of your automation. Consider an API when you want a direct capture request without maintaining a browser setup; check its options, output, and billing semantics against your needs.
Sources
- Selenium Java API: TakesScreenshot (version 3.141.59 API behavior).
- Selenium documentation (current documentation context; not evidence of universal Selenium 3 support).


