Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk4 min

How to Set a Viewport Size in Applitools Eyes (Selenium Java)

Use RectangleSize in eyes.open to set the Selenium Java page viewport in Applitools Eyes. Learn what the dimensions mean, how to choose test sizes, and how to troubleshoot failures.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In a Selenium Java test, set the page viewport when you call eyes.open: driver = eyes.open(driver, "Applitools", "Test Web Page", new RectangleSize(1024, 768));. The dimensions describe the page’s inner content area, not the full browser window. Use the WebDriver returned by eyes.open for the rest of the test.

Set the viewport in eyes.open

Applitools’ Selenium Java example imports com.applitools.eyes.RectangleSize and passes a width and height to eyes.open. Add the import and call at test setup:

import com.applitools.eyes.RectangleSize;

// Start visual testing with browser viewport set to 1024x768.
driver = eyes.open(driver, "Applitools", "Test Web Page", new RectangleSize(1024, 768));

The example’s 1024-by-768 size is illustrative, not a required default. Replace it with dimensions that represent the layout your test is intended to verify. Applitools’ example is documented at its viewport guide.

Keep the returned driver

Assign the result of eyes.open back to driver, then use that driver in subsequent navigation and test actions. The SDK may return a driver instance configured for the visual test; continuing with the original reference would not follow the documented example.

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.

What the width and height mean

RectangleSize(width, height) specifies the browser’s client viewport—the page content area available to the site. It does not specify the outer browser window, which also includes browser chrome such as tabs and toolbars. Applitools calculates the outer window size needed to produce the requested content area. See Applitools’ viewport sizing guidance.

This distinction matters when comparing the setting with Selenium’s ordinary window-size controls: changing the outer window dimensions does not necessarily yield the same inner page dimensions, because browser chrome takes up space. Setting a target viewport at the beginning of the test makes the visual check more repeatable when responsive layouts depend on available page width or height.

Choose dimensions for the layouts you need to test

Pick a size based on the application’s intended responsive breakpoints and the screens you need to validate. A single fixed viewport helps repeat runs under consistent conditions; testing more than one size can exercise layout changes at different widths. Applitools uses 1000 by 600 as a generic example in its discussion of cross-browser testing, not as a universal recommendation: Cross-browser testing with Applitools.

If you need to discover a useful size, inspect the current viewport in the browser’s JavaScript console or use a viewport-size page, as described in Applitools’ viewport-size article. Use the resulting dimensions as a starting point, then choose test sizes that correspond to the application’s actual layouts.

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

Grid and emulated-device tests use environment configuration

Do not assume the local Selenium eyes.open example configures every Applitools execution mode. The Java Ultrafast Grid quickstart describes browser and emulated-device environments separately, using Configuration.addBrowsers with entries such as DesktopBrowserInfo and ChromeEmulationInfo. Follow the current guide for the SDK and execution flow you are using: Java Ultrafast Grid quickstart. Applitools publishes guides for multiple SDK families, including Selenium and Playwright, so don’t transfer syntax between bindings without checking that SDK’s guide: Applitools documentation.

Troubleshoot viewport sizing failures

If eyes.open cannot set the requested viewport, Applitools says the SDK throws an exception and stops before the test continues. Check these causes:

  • Requested area exceeds available screen space. The outer browser window needed to create the requested content area may be larger than the available display. Try a smaller viewport or run in an environment with more screen area.
  • Viewport is below the browser’s minimum size. Raise the requested width or height to a size the browser supports.
  • Appium is targeting a mobile device. The mobile window may already be maximized, so requesting another viewport size can fail. Use the device/emulation configuration appropriate to that test rather than assuming desktop resizing behavior.
  • Windows display zoom is not 100%. Applitools identifies non-100% display zoom as a possible cause of incorrect size calculation; set Windows display scaling to 100% and retry.

These failure causes and behavior are described in Applitools’ viewport-size troubleshooting guide.

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

Or skip the browser setup

If the goal is to obtain a website screenshot rather than run an Applitools visual test, ScreenshotNeo offers a one-request screenshot API. For example, use cURL:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for parameters and response details. 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 responses identify the page verdict and billing status in headers. It also provides an MCP server with screenshot, page-info, and PDF-capture tools for AI agents. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.