Skip to content
GUIDE · SCREENSHOTS

Selenium Screenshots in Python, Java and C#: Full Page, Element and On Failure

Every way to take a screenshot with Selenium 4: the viewport, a single element, the full page in Firefox and Chrome, headless Chrome setup, automatic screenshots when a test fails, and when Playwright or a screenshot API is the better tool.

Last updated

Short answer

In Selenium Python, driver.save_screenshot('page.png') saves the visible viewport and element.screenshot('el.png') saves one element. Java uses ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE), C# uses ((ITakesScreenshot)driver).GetScreenshot().SaveAsFile(...). Full-page capture is built in only for Firefox; in Chrome, use WebDriver BiDi with origin='document' or the DevTools Page.captureScreenshot command.

Selenium's screenshot API comes from the W3C WebDriver standard, which defines two commands: capture the current viewport, and capture one element. Both always return PNG. Everything else, full-page capture in particular, depends on the browser. This guide covers each method in Python first, then Java and C#, with the full-page workarounds that actually work in 2026 and their limits. The Python examples were run against Selenium 4.54 with Chrome and Firefox in November 2026.

How to take a screenshot in Selenium Python

screenshot.py
from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument("--headless=new")
options.add_argument("--window-size=1280,800")

driver = webdriver.Chrome(options=options)   # Selenium Manager fetches chromedriver
try:
    driver.get("https://example.com")

    driver.save_screenshot("page.png")         # visible viewport, PNG only
    png = driver.get_screenshot_as_png()       # bytes: for Pillow, S3, an HTTP response
    b64 = driver.get_screenshot_as_base64()    # str: for embedding in an HTML report
finally:
    driver.quit()

You don't need webdriver-manager or a chromedriver path. Since Selenium 4.6, Selenium Manager finds your installed Chrome, downloads the matching driver and caches it, and since 4.11 it can download the browser too. The screenshot methods available on a driver and on an element:

Selenium 4.54 Python bindings.
MethodReturnsNotes
driver.save_screenshot(path)True / FalseWrites a PNG of the viewport. Returns False instead of raising if the file can't be written.
driver.get_screenshot_as_file(path)True / FalseSame as save_screenshot (it's the method that one calls).
driver.get_screenshot_as_png()bytesViewport as PNG bytes.
driver.get_screenshot_as_base64()strViewport as a base64 string, handy for HTML reports.
element.screenshot(path)True / FalsePNG of one element.
element.screenshot_as_pngbytesA property, so no parentheses.
element.screenshot_as_base64strAlso a property.
driver.save_full_page_screenshot(path)True / FalseFirefox only, as are get_full_page_screenshot_as_png() and get_full_page_screenshot_as_base64().

Two behaviors catch people out. First, save_screenshot doesn't raise if the folder doesn't exist; it returns False and writes nothing, so check the return value or create the folder first. Second, it always writes PNG. Name the file page.jpg and you get a PNG with the wrong extension, plus a UserWarning. If you need JPEG, convert the bytes:

to_jpeg.py
from io import BytesIO
from PIL import Image   # pip install pillow

png = driver.get_screenshot_as_png()
Image.open(BytesIO(png)).convert("RGB").save("page.jpg", quality=85)

Selenium screenshot of an element

Element screenshots are part of the WebDriver standard, so they work in every browser. Wait for the element to be visible first; otherwise you'll capture a placeholder, or get an exception if it isn't there yet:

element.py
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait

el = WebDriverWait(driver, 10).until(
    EC.visibility_of_element_located((By.CSS_SELECTOR, "#pricing"))
)
el.screenshot("pricing.png")    # PNG of just that element
png = el.screenshot_as_png      # a property, not a method: no parentheses
  • The driver scrolls the element into view, then crops the viewport image to the element's box. Anything covering it (a sticky header, a cookie banner) is in the screenshot too.
  • An element taller or wider than the viewport may come back cropped to what fits on screen, depending on the driver. Enlarge the window first, or use a full-page method with a clip.
  • Java: element.getScreenshotAs(OutputType.FILE). C#: ((ITakesScreenshot)element).GetScreenshot(). Both are shown below.

Selenium full page screenshot in Python

The standard screenshot command captures only the viewport, and Selenium has no cross-browser "full page" switch. There are four ways to get the whole page, and which one you use depends on the browser:

MethodBrowsersProsCons
save_full_page_screenshot()FirefoxOne line, built inFirefox only; Chrome's driver class has no such method
WebDriver BiDi capture_screenshot(origin='document')Chrome (tested); any driver with BiDi screenshotsStandards-based, no CDPNeeds enable_bidi; Selenium's BiDi API is newer and still changing
CDP Page.captureScreenshot + captureBeyondViewportChrome, EdgePrecise, works on Selenium 4 versions without BiDiChromium only; the parameter is marked experimental in the protocol
Resize the window, then screenshotAnyNo special APIsCrops the bottom, stretches 100vh sections, limited by screen size when headed

Firefox: built-in full page screenshots

firefox_full_page.py
from selenium import webdriver

options = webdriver.FirefoxOptions()
options.add_argument("-headless")

driver = webdriver.Firefox(options=options)
try:
    driver.get("https://example.com")
    driver.save_full_page_screenshot("full.png")      # whole document
    png = driver.get_full_page_screenshot_as_png()    # or as bytes
finally:
    driver.quit()

Chrome: WebDriver BiDi

WebDriver BiDi is the newer bidirectional protocol that Selenium is moving to. Its screenshot command takes origin='document' to capture the whole page rather than the viewport:

chrome_full_page_bidi.py
import base64
from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument("--headless=new")
options.enable_bidi = True                     # open a WebDriver BiDi connection

driver = webdriver.Chrome(options=options)
try:
    driver.get("https://example.com")
    data = driver.browsing_context.capture_screenshot(
        context=driver.current_window_handle,  # the tab to capture
        origin="document",                     # the whole page, not the viewport
    )
    with open("full.png", "wb") as f:
        f.write(base64.b64decode(data))
finally:
    driver.quit()

Chrome: DevTools protocol (CDP)

The approach Puppeteer-style tools use: ask Chrome for the page's content size, then capture a clip of that size with captureBeyondViewport. It works with Chrome and Edge drivers:

chrome_full_page_cdp.py
import base64
from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument("--headless=new")

driver = webdriver.Chrome(options=options)   # also works with webdriver.Edge
try:
    driver.get("https://example.com")

    # 1. Ask Chrome how big the page is (in CSS pixels)
    metrics = driver.execute_cdp_cmd("Page.getLayoutMetrics", {})
    width = metrics["cssContentSize"]["width"]
    height = metrics["cssContentSize"]["height"]

    # 2. Capture that whole area, including what's below the fold
    shot = driver.execute_cdp_cmd("Page.captureScreenshot", {
        "format": "png",
        "captureBeyondViewport": True,
        "clip": {"x": 0, "y": 0, "width": width, "height": height, "scale": 1},
    })
    with open("full.png", "wb") as f:
        f.write(base64.b64decode(shot["data"]))
finally:
    driver.quit()

Use cssContentSize, not the older contentSize, which the protocol marks deprecated. CDP doesn't work with Firefox: Selenium now raises CDP support for Firefox has been removed. Please switch to WebDriver BiDi.

The window-resize method and its limits

The oldest trick is to read the page height, make the window that tall, and screenshot <body>:

resize_full_page.py
from selenium.webdriver.common.by import By

driver.get("https://example.com")
height = driver.execute_script("return document.documentElement.scrollHeight")
driver.set_window_size(1280, height)
driver.find_element(By.TAG_NAME, "body").screenshot("full.png")
  • The window isn't the viewport. set_window_size sizes the whole window, including browser UI, even in headless mode. In our test (Chrome 158, Windows), the viewport came out 152 px shorter than the window, so the bottom of the page was cut off.
  • Full-height sections stretch. Anything sized in vh units grows to the new window height, so a hero set to 100vh becomes thousands of pixels tall.
  • Headed browsers are limited by the screen. The OS won't make a window taller than the display, so this only works reliably headless.
  • Lazy content still needs scrolling. Images that load on scroll stay blank unless you scroll through the page first. That applies to every method here.

Use BiDi or CDP on Chrome and the built-in method on Firefox. Keep the resize trick for drivers that support neither.

Selenium headless Chrome in Python

headless.py
from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument("--headless=new")           # same as --headless on Chrome 132+
options.add_argument("--window-size=1280,800")   # the default headless window is small
# In a Linux container running as root, Chrome also needs:
# options.add_argument("--no-sandbox")
# options.add_argument("--disable-dev-shm-usage")

driver = webdriver.Chrome(options=options)
print(driver.execute_script("return [window.innerWidth, window.innerHeight]"))
driver.quit()
  • The old headless property is gone. options.headless = True was removed from Selenium; pass the argument instead. Selenium's own docs use --headless=new.
  • Both headless flags now mean the same thing. --headless and --headless=new are equivalent: since Chrome 132, the old headless implementation isn't part of Chrome; it ships separately as chrome-headless-shell. Plain --headless runs the real Chrome without a visible window.
  • Set the window size. Headless Chrome starts with a small window, so responsive sites serve their mobile layout and screenshots look wrong. Even with --window-size=1280,800, the viewport is smaller than the window; we measured 1262 × 648 on Windows. If exact viewport pixels matter, check window.innerWidth and window.innerHeight like the snippet does.
  • Firefox uses options.add_argument("-headless") on FirefoxOptions.

Headless Chrome in Selenium Python not working?

  • Browser opens visibly: you're on an old pattern (options.headless = True, or chrome_options=). Use options.add_argument('--headless=new') and webdriver.Chrome(options=options).
  • Crashes on a Linux server or in Docker: Chrome refuses to run as root without --no-sandbox, and Docker's small default /dev/shm can crash it; --disable-dev-shm-usage works around that. Better still, run as a non-root user. See headless Chrome in Docker.
  • Works headed, different headless: almost always window size. Set --window-size and compare window.innerWidth.
  • Site blocks you only in headless: headless Chrome identifies itself as HeadlessChrome in its user agent, and some sites refuse it. Selenium isn't a stealth tool; respect the site's terms.
  • Driver version errors: delete hard-coded chromedriver paths and third-party driver managers, and let Selenium Manager match the driver to your Chrome.

Selenium screenshot in Java

Cast the driver to TakesScreenshot and pick an OutputType: FILE (a temp file you copy somewhere), BYTES, or BASE64. Elements implement the same interface directly:

TakeScreenshot.java
// Maven: org.seleniumhq.selenium:selenium-java:4.54.0
import java.io.File;
import java.nio.file.*;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class TakeScreenshot {
  public static void main(String[] args) throws Exception {
    ChromeOptions options = new ChromeOptions();
    options.addArguments("--headless=new", "--window-size=1280,800");
    WebDriver driver = new ChromeDriver(options);
    try {
      driver.get("https://example.com");

      // Viewport screenshot to a file
      File src = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
      Files.copy(src.toPath(), Path.of("page.png"), StandardCopyOption.REPLACE_EXISTING);

      // One element, as bytes
      WebElement heading = driver.findElement(By.cssSelector("h1"));
      Files.write(Path.of("heading.png"), heading.getScreenshotAs(OutputType.BYTES));
    } finally {
      driver.quit();
    }
  }
}

The temp file from OutputType.FILE is deleted when the JVM exits, so copy it right away. Files.copy does that without Apache Commons IO. Full-page capture works the same way as in Python: built into FirefoxDriver, through the DevTools protocol on ChromeDriver (add import java.util.Base64; and import java.util.Map;, plus the FirefoxDriver and FirefoxOptions imports):

FullPage.java
// Firefox: built in
FirefoxOptions ffOptions = new FirefoxOptions();
ffOptions.addArguments("-headless");
FirefoxDriver firefox = new FirefoxDriver(ffOptions);
firefox.get("https://example.com");
File full = firefox.getFullPageScreenshotAs(OutputType.FILE);
Files.copy(full.toPath(), Path.of("full-firefox.png"), StandardCopyOption.REPLACE_EXISTING);
firefox.quit();

// Chrome: through the DevTools protocol
ChromeDriver chrome = new ChromeDriver(options);
chrome.get("https://example.com");
Map<String, Object> metrics = chrome.executeCdpCommand("Page.getLayoutMetrics", Map.of());
@SuppressWarnings("unchecked")
Map<String, Object> size = (Map<String, Object>) metrics.get("cssContentSize");
Map<String, Object> clip = Map.of("x", 0, "y", 0, "scale", 1,
    "width", size.get("width"), "height", size.get("height"));
Map<String, Object> shot = chrome.executeCdpCommand("Page.captureScreenshot",
    Map.of("format", "png", "captureBeyondViewport", true, "clip", clip));
Files.write(Path.of("full-chrome.png"), Base64.getDecoder().decode((String) shot.get("data")));
chrome.quit();

Selenium screenshot in C#

Program.cs
// dotnet add package Selenium.WebDriver
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;

var options = new ChromeOptions();
options.AddArgument("--headless=new");
options.AddArgument("--window-size=1280,800");

using var driver = new ChromeDriver(options);   // Dispose() quits the browser
driver.Navigate().GoToUrl("https://example.com");

// Viewport screenshot
Screenshot shot = ((ITakesScreenshot)driver).GetScreenshot();
shot.SaveAsFile("page.png");
byte[] png = shot.AsByteArray;

// One element
IWebElement heading = driver.FindElement(By.CssSelector("h1"));
((ITakesScreenshot)heading).GetScreenshot().SaveAsFile("heading.png");

GetScreenshot() returns a Screenshot with SaveAsFile(path) (always PNG), AsByteArray and AsBase64EncodedString. The image-format overload of SaveAsFile from Selenium 3 no longer exists. Full page, continuing from the code above:

FullPage.cs
// Firefox: built in (add "using OpenQA.Selenium.Firefox;" at the top of the file)
var ffOptions = new FirefoxOptions();
ffOptions.AddArgument("-headless");
using var firefox = new FirefoxDriver(ffOptions);
firefox.Navigate().GoToUrl("https://example.com");
firefox.GetFullPageScreenshot().SaveAsFile("full-firefox.png");

// Chrome: through the DevTools protocol (numbers come back as long or double)
var metrics = (Dictionary<string, object>)driver.ExecuteCdpCommand("Page.getLayoutMetrics", new())!;
var size = (Dictionary<string, object>)metrics["cssContentSize"];
var result = (Dictionary<string, object>)driver.ExecuteCdpCommand("Page.captureScreenshot", new()
{
    ["format"] = "png",
    ["captureBeyondViewport"] = true,
    ["clip"] = new Dictionary<string, object>
    {
        ["x"] = 0, ["y"] = 0, ["scale"] = 1,
        ["width"] = Convert.ToDouble(size["width"]),
        ["height"] = Convert.ToDouble(size["height"]),
    },
})!;
File.WriteAllBytes("full-chrome.png", Convert.FromBase64String((string)result["data"]));

Selenium screenshot on failure

The useful screenshot is the one taken at the moment a test fails, before the browser closes. The catch in every framework is ordering: the screenshot hook has to run before the teardown that calls quit().

pytest

pytest doesn't tell fixtures whether the test passed, but its docs show how to expose the result: a pytest_runtest_makereport hook stores each phase's report on the test item, and the fixture reads it during teardown, while the driver is still alive:

conftest.py
# conftest.py
import pathlib

import pytest
from selenium import webdriver

phase_report_key = pytest.StashKey[dict]()


@pytest.hookimpl(wrapper=True, tryfirst=True)
def pytest_runtest_makereport(item, call):
    rep = yield
    # Keep each phase's report (setup / call / teardown) on the test item
    item.stash.setdefault(phase_report_key, {})[rep.when] = rep
    return rep


@pytest.fixture
def driver(request):
    options = webdriver.ChromeOptions()
    options.add_argument("--headless=new")
    options.add_argument("--window-size=1280,800")
    drv = webdriver.Chrome(options=options)
    yield drv
    try:
        report = request.node.stash.get(phase_report_key, {})
        if "call" in report and report["call"].failed:
            folder = pathlib.Path("screenshots")
            folder.mkdir(exist_ok=True)
            drv.save_screenshot(str(folder / f"{request.node.name}.png"))
    finally:
        drv.quit()

Any test that takes the driver fixture now leaves screenshots/test_name.png behind when it fails, and nothing when it passes. To show the image inside a pytest-html report, attach drv.get_screenshot_as_base64() instead of writing a file.

JUnit 5 and JUnit 6

Use an AfterTestExecutionCallback. JUnit runs it immediately after the test method and before any @AfterEach methods, so the browser is still open. A TestWatcher runs too late if @AfterEach already quit the driver.

ScreenshotOnFailure.java
// ScreenshotOnFailure.java (JUnit 5 / 6 extension)
import java.io.File;
import java.nio.file.*;
import org.junit.jupiter.api.extension.AfterTestExecutionCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.openqa.selenium.*;

public class ScreenshotOnFailure implements AfterTestExecutionCallback {

  public interface HasDriver { WebDriver driver(); }

  @Override
  public void afterTestExecution(ExtensionContext context) throws Exception {
    if (context.getExecutionException().isEmpty()) return;   // the test passed
    if (!(context.getRequiredTestInstance() instanceof HasDriver test)) return;

    File src = ((TakesScreenshot) test.driver()).getScreenshotAs(OutputType.FILE);
    Path dest = Path.of("target", "screenshots",
        context.getRequiredTestClass().getSimpleName() + "_"
            + context.getRequiredTestMethod().getName() + ".png");
    Files.createDirectories(dest.getParent());
    Files.copy(src.toPath(), dest, StandardCopyOption.REPLACE_EXISTING);
  }
}
LoginTest.java
// LoginTest.java
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.extension.ExtendWith;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

@ExtendWith(ScreenshotOnFailure.class)
class LoginTest implements ScreenshotOnFailure.HasDriver {
  WebDriver driver;

  public WebDriver driver() { return driver; }

  @BeforeEach void start() { driver = new ChromeDriver(); }

  // Runs AFTER the extension, so the browser is still open for the screenshot
  @AfterEach void stop() { driver.quit(); }

  @Test void showsDashboardAfterLogin() {
    driver.get("https://example.com/login");
    Assertions.assertTrue(driver.getTitle().contains("Dashboard"));
  }
}

TestNG has the same idea in ITestListener.onTestFailure, and NUnit exposes the outcome in [TearDown] through TestContext.CurrentContext.Result.Outcome. The rule is identical everywhere: capture before quit().

Python screenshot of a webpage without Selenium

If you just need an image of a page, and aren't testing an app, Selenium is more machinery than the job needs. Two simpler options:

Playwright for Python

One call does a full-page capture in Chromium, Firefox and WebKit, and element screenshots wait for the element automatically. Our Playwright screenshot guide covers masks, formats and retina output.

playwright_screenshot.py
# pip install playwright && playwright install chromium
from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch()
    page = browser.new_page(viewport={"width": 1280, "height": 800})
    page.goto("https://example.com")
    page.screenshot(path="full.png", full_page=True)      # full page in any browser
    page.locator("h1").screenshot(path="heading.png")     # waits for the element
    browser.close()

A screenshot API

No browser at all on your side: send the URL, get an image back. With RenderKit, a screenshot costs 1 credit, and the response includes a hosted image URL:

api_screenshot.py
import os
import requests

r = requests.post(
    "https://api.renderkit.tech/v1/screenshot",
    headers={"x-api-key": os.environ["RENDERKIT_API_KEY"]},
    json={
        "url": "https://example.com",
        "full_page": True,
        "block_cookie_banners": True,
        "format": "jpeg",
        "quality": 85,
    },
    timeout=60,
)
r.raise_for_status()
image_url = r.json()["data"]["url"]     # hosted on cdn.renderkit.tech

img = requests.get(image_url, headers={"User-Agent": "my-app/1.0"}, timeout=60)
with open("full.jpg", "wb") as f:
    f.write(img.content)

You also get full_page, selector for elements, format png/jpeg/webp, device_scale up to 3, and block_ads, block_cookie_banners and hide_selectors to clean the page up. The free trial is 500 credits for 14 days (1 concurrent render, 15-second timeout), and Hobby is $9/month for 5,000 screenshots. The trade-offs: the API only reaches public URLs (not localhost or your VPN), renders run from France, and images are served from a public CDN URL. See the Python screenshot API page.

Selenium vs Playwright vs a screenshot API

SeleniumPlaywrightRenderKit API
Viewport screenshotsave_screenshot()page.screenshot()Default
Full page in ChromeBiDi or CDP workaroundfull_page=Truefull_page: true
Full page in Firefoxsave_full_page_screenshot()full_page=TrueChromium only
Elementelement.screenshot()locator.screenshot() (auto-waits)selector
FormatsPNG onlyPNG, JPEG, WebPPNG, JPEG, WebP
Transparent backgroundNoomit_backgroundomit_background
Masking or hiding elementsYour own JavaScriptmask, stylehide_selectors, ad and cookie-banner blocking
Screenshot on failureFramework hook (above)Config switchNot a testing tool
Runs whereYour machine or gridYour machineHosted; public URLs only
CostFreeFree500 free credits, then from $9/month

If your test suite is already in Selenium, the methods above are all you need, and rewriting tests just for screenshots rarely pays off. For new browser automation, Playwright's screenshot API is simpler. For screenshots as a product feature (link previews, archiving, monitoring), an API saves you from running browsers in production.

Common Selenium screenshot problems

ProblemCauseFix
save_screenshot returns False, no fileThe folder doesn't exist or isn't writableCreate the folder first; check the return value
UserWarning: name doesn't match file typeSelenium only writes PNGUse .png, or convert the bytes with Pillow
'WebDriver' object has no attribute 'save_full_page_screenshot'That method exists only on the Firefox driverUse BiDi or CDP on Chrome
CDP support for Firefox has been removedexecute_cdp_cmd called on FirefoxUse save_full_page_screenshot() or BiDi
Screenshot shows the mobile layoutSmall default headless window--window-size=1280,800 or larger
Blank or half-loaded pageCaptured before content renderedWebDriverWait for a specific element first
Bottom of full page missing (resize method)Window size includes browser UISwitch to BiDi or CDP
Element screenshot cut offElement larger than the viewportEnlarge the window, or clip a full-page capture

Common questions

Yes, but how depends on the browser. Firefox has it built in: driver.save_full_page_screenshot('full.png') in Python or getFullPageScreenshotAs in Java. For Chrome and Edge, enable WebDriver BiDi and call browsing_context.capture_screenshot with origin='document', or use the DevTools command Page.captureScreenshot with captureBeyondViewport and a clip set to the page's content size.

Call driver.save_screenshot('page.png') after driver.get(url). It saves the visible viewport as PNG and returns False if the file can't be written. Use driver.get_screenshot_as_png() for bytes or driver.get_screenshot_as_base64() for a base64 string.

Find the element, wait until it's visible, then call element.screenshot('element.png') in Python. element.screenshot_as_png is a property that returns bytes. In Java use element.getScreenshotAs(OutputType.FILE), and in C# cast the element to ITakesScreenshot and call GetScreenshot().

Capture it in a hook that runs before the browser quits. In pytest, add a pytest_runtest_makereport hook that stores the report, and save the screenshot in the driver fixture's teardown when the call phase failed. In JUnit 5 or 6, implement AfterTestExecutionCallback, which runs before @AfterEach, and check context.getExecutionException().

Create webdriver.ChromeOptions(), call options.add_argument('--headless=new') and options.add_argument('--window-size=1280,800'), then pass options=options to webdriver.Chrome. The old options.headless = True property was removed. On Chrome 132 and later, --headless and --headless=new both run the full Chrome without a window.

The usual causes are an outdated way of enabling headless mode, a small default window that triggers the mobile layout, running as root in Linux or Docker without --no-sandbox, a small /dev/shm in Docker (try --disable-dev-shm-usage), or a hard-coded chromedriver that doesn't match your Chrome. Remove driver managers and let Selenium Manager pick the driver.

Not directly. WebDriver screenshots are always PNG, and Selenium warns if your file name doesn't end in .png. Take the bytes with get_screenshot_as_png() and convert them with Pillow: Image.open(BytesIO(png)).convert('RGB').save('page.jpg', quality=85).

Use Playwright for Python, where page.screenshot(path='page.png', full_page=True) captures the whole page in one call, or call a screenshot API such as RenderKit with requests and download the returned image. Both avoid WebDriver setup, and the API also avoids running a browser yourself.

Ship your first render in 60 seconds.

500 free credits to start. No card. Cancel by ignoring it.

Get your free key$npm i renderkit-sdk