Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use AShot as a Selenium-side image utility, not as an Allure plug-in. For a full page, create an AShot instance with ShootingStrategies.viewportPasting(100); for one element, pass the located WebElement to takeScreenshot. AShot returns a Screenshot object whose BufferedImage you can save, compare, or attach to an Allure report through your test framework.

The important qualification is maintenance: the project’s release information is old, its README and artifact metadata disagree about the version, and historical issues show environment-sensitive cropping. Verify the resolved dependency and run a smoke test on your exact browser, driver, operating system, Selenium version, and device-pixel ratio.

What AShot does—and what Allure does

AShot is a Java library layered on Selenium WebDriver. Its documented responsibilities are taking screenshots, stitching viewport captures into a longer image, cropping a selected element, decorating images, and comparing images. It is not an Allure module.

Allure Report is the reporting layer. Your test framework produces an attachment from an image file or byte array, and the Allure adapter displays that attachment. AShot can supply the image, but you still need the current attachment API for your framework (JUnit 5, TestNG, or another adapter). The official Allure Selenium guidance demonstrates Selenium’s own TakesScreenshot path; it does not establish a dedicated AShot adapter.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check the dependency before writing code

The AShot README shows this Maven coordinate:

<dependency>
  <groupId>ru.yandex.qatools.ashot</groupId>
  <artifactId>ashot</artifactId>
  <version>1.5.4</version>
</dependency>

The repository’s release panel identifies 1.5.2, dated December 9, 2015, as its latest release, while Maven Central lists 1.5.4. Treat those as inconsistent signals, not proof of a current release. Resolve the version in your build and inspect the dependency tree. The 1.5.4 metadata lists selenium-remote-driver 2.53.0, so check for conflicts if your application uses modern Selenium.

With Maven, run mvn dependency:tree and confirm which Selenium artifacts win dependency convergence. Pin compatible versions in your project rather than silently accepting an old transitive driver.

Capture a full page with viewport pasting

Some WebDriver implementations return only the visible viewport. AShot’s documented workaround repeatedly captures the viewport while scrolling and pastes the pieces together.

import ru.yandex.ashot.AShot;
import ru.yandex.ashot.Screenshot;
import ru.yandex.ashot.shooting.ShootingStrategies;

Screenshot screenshot = new AShot()
    .shootingStrategy(ShootingStrategies.viewportPasting(100))
    .takeScreenshot(driver);

The numeric argument is part of the AShot API example. Interpret it according to the library version actually resolved by your build; do not assume that an old strategy has identical timing or scrolling behavior in a current browser.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Save the returned image

import javax.imageio.ImageIO;
import java.io.File;

ImageIO.write(screenshot.getImage(), "PNG", new File("target/full-page.png"));

Use an image format that matches the extension. The file write is ordinary Java I/O, not an Allure operation. Make sure the page is in a stable state before capture: wait for the application’s loading indicator to disappear, settle animations, and load lazy content that must appear in the final image.

Why full-page output can be wrong

  • Viewport pasting depends on scroll height, fixed headers, and the browser’s screenshot coordinate system.
  • Sticky elements may be pasted repeatedly at every scroll position.
  • Lazy images can still be unloaded when AShot reaches their location.
  • Device-pixel-ratio differences can make the image dimensions and crop coordinates disagree.
  • Historical reports include a Retina, device-pixel-ratio-2 coordinate problem and a Chrome 80 full-page clipping problem. These reports justify a local check; they do not predict behavior for every current browser.

Capture one known page in each supported environment and assert dimensions or inspect the resulting image before relying on it in a regression suite.

Capture one WebElement

Locate the element with Selenium and pass it to AShot:

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import ru.yandex.ashot.AShot;
import ru.yandex.ashot.Screenshot;

WebElement element = driver.findElement(By.cssSelector("#my_element"));
Screenshot screenshot = new AShot().takeScreenshot(driver, element);
ImageIO.write(screenshot.getImage(), "PNG", new File("target/element.png"));

AShot calculates the element coordinates and crops the captured image. Its documented default coordinate approach uses jQuery. If JavaScript execution causes trouble, use the WebDriver-based provider:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import ru.yandex.ashot.coordinates.WebDriverCoordsProvider;

Screenshot screenshot = new AShot()
    .coordsProvider(new WebDriverCoordsProvider())
    .takeScreenshot(driver, element);

Element capture is still sensitive to browser zoom, scroll position, transforms, device pixel ratio, and an element that changes size between locating and capturing. Wait for visibility and final layout, and avoid taking the screenshot while a transition is running.

Compare screenshots and control noisy regions

AShot’s image comparison API accepts a baseline and an actual BufferedImage:

import ru.yandex.ashot.comparison.ImageDiffer;
import ru.yandex.ashot.comparison.ImageDiff;

ImageDiff diff = new ImageDiffer().makeDiff(baseline, actual);
BufferedImage marked = diff.getMarkedImage();
ImageIO.write(marked, "PNG", new File("target/diff.png"));

The project also documents excluding selected WebElements and ignoring pixels of a configured color. Use those controls for timestamps, rotating ads, avatars, or other intentionally dynamic regions. Keep the exclusion narrowly scoped: masking too much can hide a real layout regression.

Pixel comparison is meaningful only when rendering is controlled. Use the same browser family and version, viewport, operating system fonts, device scale factor, color scheme, locale, and test data. Freeze clocks and random content where possible. Compare images after network and UI activity has settled, and record the dimensions alongside the diff.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Attach an AShot image to Allure

Capture and reporting are separate steps. A practical flow is:

  1. Call AShot and obtain screenshot.getImage().
  2. Encode or write that image using the attachment mechanism supplied by your current Allure test adapter.
  3. Use the adapter’s image MIME type (normally image/png for a PNG) and a descriptive attachment name.
  4. Open the generated Allure report and verify that the attachment is displayed.

For JUnit 5, follow the current Allure Java adapter documentation for the exact annotation or lifecycle method in your project version. Do not assume that a method shown for Selenium’s TakesScreenshot accepts an AShot object directly; pass bytes or a file in the form that the adapter documents.

If you only need a viewport image, Selenium’s native TakesScreenshot interface avoids adding AShot:

byte[] png = ((org.openqa.selenium.TakesScreenshot) driver)
    .getScreenshotAs(org.openqa.selenium.OutputType.BYTES);

Choose AShot when you specifically need viewport-pasted full pages, WebElement cropping, coordinate-provider choices, or its image-difference utilities. Choose the native interface when a simple viewport capture and an Allure attachment are sufficient.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Strategies, coordinates, and customization

Shooting strategies

viewportPasting is designed for drivers that expose only the viewport. AShot also permits composed and custom strategies, which is useful when a browser needs a special scroll, wait, or stitching adjustment. Keep the strategy configuration close to the driver profile so a workaround for one browser does not silently affect all tests.

Coordinate providers

The default jQuery-based calculation may fail when script injection is blocked or the page’s JavaScript environment behaves unusually. WebDriverCoordsProvider delegates coordinate lookup to WebDriver APIs. Test both providers if your pages use transforms, nested scrolling containers, or unusual zoom settings.

Element and region handling

Capture only after the element is present, visible, and laid out. For a fixed navigation bar or cookie dialog, decide whether it belongs in the baseline; hiding or excluding it can be more reliable than accepting repeated pixels in a stitched image.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting checklist

Only the upper-left corner appears

You may be using a viewport-only driver without a stitching strategy, or the strategy may be incompatible with the browser/driver combination. Try ShootingStrategies.viewportPasting(100), verify the page’s scroll height, and run the same test on a small static page. If the result is still clipped, capture the viewport natively or evaluate a browser-specific/custom strategy.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Element coordinates are offset

Check browser zoom and device pixel ratio, then try WebDriverCoordsProvider. Ensure the page has finished scrolling and layout changes before locating the element. A Retina-related historical issue shows why a local smoke test is necessary.

Full-page image has repeated headers

A fixed or sticky header is painted in every viewport before AShot pastes the images. Hide that selector temporarily, crop the assembled image, or use a custom strategy that accounts for the fixed region.

Chrome 80-era clipping or blank sections

A historical issue reported full-page clipping on Chrome 80. Confirm the exact Chrome and driver versions, reduce the page to a reproducible case, and test a native viewport screenshot. Do not infer that a fix for that old report applies to your current stack.

Dependency or class errors at startup

Inspect mvn dependency:tree. AShot 1.5.4’s Selenium 2.53.0-era metadata can conflict with newer Selenium modules. Resolve one coherent Selenium version set, and verify that your Java, Selenium, browser, and driver versions are supported together.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Allure shows no attachment

The image may have been written to a path outside the test results directory, or the adapter call may use the wrong MIME type or lifecycle. First open the PNG independently, then follow the current adapter’s documented byte/file attachment method and confirm the results directory is included when generating the report.

Performance, reliability, and cost considerations

A full-page viewport-pasting capture performs multiple scrolls and image operations, so it is slower and more memory-intensive than one viewport screenshot. Limit full-page captures to failure diagnostics or visual tests that need them. Element captures are usually smaller, but still wait for layout and image loading.

Keep screenshot files out of source control and apply retention rules to CI artifacts. For parallel tests, give each capture a unique path. A failed or partial image should be treated as diagnostic evidence, not a passing visual baseline.

Because AShot’s release signals are dated, establish a small compatibility test as part of browser upgrades. Test at least one tall page, one element near the bottom of the page, a high-DPI environment, and the Allure attachment path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. One GET request returns PNG, JPEG, WebP, or PDF without maintaining Selenium drivers:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

See the ScreenshotNeo documentation for request options. Before capture it accepts cookie/consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account to try it.

Frequently Asked Questions

Is AShot required for an Allure screenshot?

No. Selenium’s TakesScreenshot interface can provide a viewport image; AShot is useful for viewport-pasted full pages, element cropping, and image comparison.

Can AShot capture a PDF?

The documented AShot use case is image screenshots and comparisons. Use a browser or service with explicit PDF support when PDF output is required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Should I upgrade AShot to a newer version?

The available version signals are inconsistent and dated. Verify the artifact, resolved dependencies, and browser compatibility in your own build rather than assuming a current supported release.

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.