Set Chrome’s mobile emulation before you start the Selenium session, then navigate to the site and save a screenshot. You can use a ChromeDriver device preset or specify a custom viewport size and pixel ratio. The examples below use Python and capture the visible viewport; a viewport screenshot is not the same as a full-page capture.
Configure mobile emulation before starting Chrome
ChromeDriver supports a named device profile and custom device metrics. Choose a preset when you want convenience; use custom metrics when you need an explicit viewport that is not in the installed device list. The preset names available depend on your Chrome and ChromeDriver versions, and an unrecognized name causes an error. Chrome for Developers documents both configuration paths.
As an Amazon Associate I earn from qualifying purchases.
Python: custom viewport
This runnable example sets a 390-by-844 CSS-pixel viewport with a pixel ratio of 3. It waits for the page load before saving the visible viewport screenshot as mobile.png. Change the dimensions to match the layout or breakpoint you need to inspect.
Free tools Windows power users keep installed
One-click scans. No signup required.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
mobile_emulation = {
"deviceMetrics": {"width": 390, "height": 844, "pixelRatio": 3},
"mobile": True,
"touch": True,
}
options.add_experimental_option("mobileEmulation", mobile_emulation)
driver = webdriver.Chrome(options=options)
try:
driver.get("https://example.com")
driver.save_screenshot("mobile.png")
finally:
driver.quit()
Install Selenium and make sure a compatible Chrome and ChromeDriver setup is available to your Selenium installation. The mobile and touch settings default to true in ChromeDriver’s documented emulation configuration, so they can be omitted when those defaults are suitable. The ChromeDriver documentation also describes optional user-agent and client-hint values for pages whose behavior depends on client identity.
#1 Best Overall
- YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
- LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
- MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
- NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
- BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.
Python: use a recognized device preset
Replace the custom metrics dictionary with a deviceName that is recognized by the ChromeDriver version in use:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_experimental_option(
"mobileEmulation",
{"deviceName": "Pixel 2"}
)
driver = webdriver.Chrome(options=options)
try:
driver.get("https://example.com")
driver.save_screenshot("mobile.png")
finally:
driver.quit()
Use a device name from the emulated-device settings supported by your installed Chrome/ChromeDriver. If ChromeDriver reports that the device name is unknown, choose a listed profile or switch to explicit metrics. Presets and supported names can vary by version.
JavaScript: Selenium with Chromium options
In Selenium’s JavaScript binding, Chromium options expose setMobileEmulation. This example uses explicit metrics and saves the visible viewport screenshot:
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, 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 minuteconst { Builder } = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
const fs = require('node:fs');
(async () => {
const options = new chrome.Options();
options.setMobileEmulation({
deviceMetrics: { width: 390, height: 844, pixelRatio: 3 },
mobile: true,
touch: true
});
const driver = await new Builder()
.forBrowser('chrome')
.setChromeOptions(options)
.build();
try {
await driver.get('https://example.com');
const image = await driver.takeScreenshot();
fs.writeFileSync('mobile.png', image, 'base64');
} finally {
await driver.quit();
}
})();
For a named profile, pass { deviceName: 'Pixel 2' } to setMobileEmulation instead of the custom metrics object. Check the Selenium binding documentation for your installed version if the method signature differs; the Selenium Chrome options documentation describes the Chromium options API.
Rank #2
- Carrier: This phone is locked to Tracfone, which means this device can only be used on the Tracfone wireless network. Tracfone plan required, activating is easy, just 3 steps.
- DISPLAY: Immersive viewing on a 6.7-inch super-bright 120Hz display with powerful stereo speakers and Bass Boost for cinematic entertainment.
- CAMERA SYSTEM: Advanced 50MP Quad Pixel camera captures sharp, detailed photos and videos in any lighting condition
- PERFORMANCE: Lightning-fast 5G connectivity paired with a powerful processor and RAM Boost for smooth multitasking.
- BATTERY LIFE: Long-lasting 5000mAh battery with TurboPower charging technology delivers hours of power in minutes.
Choose viewport dimensions that answer your question
A mobile screenshot depends on more than a label such as “phone.” Pick the dimensions and behavior that match the responsive-layout case you are checking:
- Width and height: Set the intended viewport dimensions in CSS pixels. For responsive testing, capture representative widths around the breakpoints you care about rather than relying on a single size.
- Pixel ratio: Set
pixelRatioto model device scale. ChromeDriver documentation gives examples of 360 × 640 at ratio 3.0 and 412 × 823 at ratio 1.75; these are examples, not universal defaults. See the ChromeDriver examples. - Orientation: To check landscape behavior, use a viewport with landscape width and height and capture it separately from portrait.
- Touch and mobile behavior: These are enabled by default in the documented configuration; set them explicitly if you want the test setup to make the intended behavior clear.
- User agent and client hints: Configure them only when the site’s response depends on those identity signals. They affect how the page responds, not just how it is sized.
Use a preset when you want an established device configuration; use custom metrics when the size itself is the test variable. Keep the chosen dimensions, pixel ratio, browser version, and driver version with the screenshot so comparisons have context.
Wait for the content you need, then capture
A successful navigation does not guarantee that images, client-rendered content, or other delayed elements are ready. Wait for the relevant element or state before saving the screenshot. For example, to wait until a page heading appears, add this after driver.get(...) in Python:
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesfrom selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
WebDriverWait(driver, 20).until(
EC.visibility_of_element_located((By.CSS_SELECTOR, "h1"))
)
Use a selector that represents the content you actually need to inspect. Replace the immediate screenshot call in the earlier Python example with the wait and save lines above. Waiting for a visible heading is only an example; a site may need a different readiness condition.
Rank #3
- YOUR CONTENT, SUPER SMOOTH: The ultra-clear 6.7" FHD+ Super AMOLED display of Galaxy A17 5G helps bring your content to life, whether you're scrolling through recipes or video chatting with loved ones.¹
- LIVE FAST. CHARGE FASTER: Focus more on the moment and less on your battery percentage with Galaxy A17 5G. Super Fast Charging powers up your battery so you can get back to life sooner.²
- MEMORIES MADE PICTURE PERFECT: Capture every angle in stunning clarity, from wide family photos to close-ups of friends, with the triple-lens camera on Galaxy A17 5G.
- NEED MORE STORAGE? WE HAVE YOU COVERED: With an improved 2TB of expandable storage, Galaxy A17 5G makes it easy to keep cherished photos, videos and important files readily accessible whenever you need them.³
- BUILT TO LAST: With an improved IP54 rating, Galaxy A17 5G is even more durable than before.⁴ It’s built to resist splashes and dust and comes with a stronger yet slimmer Gorilla Glass Victus front and Glass Fiber Reinforced Polymer back.
Viewport screenshots and full-page screenshots are different
save_screenshot and Selenium’s standard screenshot operation capture the currently visible browser viewport. Content below the fold is not included just because the page has loaded. In Chrome DevTools, the corresponding distinction is between “Capture screenshot” for the visible viewport and “Capture a full size screenshot” for the whole page. Chrome DevTools documents its screenshot options.
Full-page capture support depends on the browser and WebDriver implementation rather than being interchangeable with a viewport screenshot. If the requirement is a complete long page, verify the full-page method supported by your specific setup and confirm the resulting image dimensions and content. For responsive checks, separate viewport shots are often more useful because they preserve the actual visible area at each target size.
Understand what mobile emulation does—and does not—test
Chrome’s device metric overrides affect screen and inner-window dimensions and the results of device-width and device-height media queries. That makes emulation useful for checking responsive layouts and mobile-oriented browser behavior. The Chrome DevTools Protocol describes the metric overrides.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
It is not a substitute for physical-device validation. Microsoft Edge Developer documentation calls device emulation “a first-order approximation of the look and feel of your page on a mobile device” and notes that it does not run code on mobile hardware. Test on an actual target device when the result depends on hardware, browser-specific implementation, or real-device interaction. Microsoft’s device-mode guidance.
Rank #4
- PRIVACY DISPLAY: Automatically hide your screen from those beside you. The built-in privacy display can be preset¹ to turn on when receiving notifications, typing passwords, or using specific apps
- TYPE IT IN. TRANSFORM IT FAST: Enhance any shot in seconds on your smartphone by using Photo Assist² with Galaxy AI.³ Add objects, restore details, or apply new styles by simply typing or tapping
- NIGHTS, CAPTURED CLEARLY: From gigs to city lights, record and capture moments after dark with clarity using Nightography so your photos and videos stay crisp and clear on your Samsung Galaxy
- MAKE IT. EDIT IT. SHARE IT: Turn everyday moments into something personal with creative tools built right into your mobile phone, whether it’s a special contact photo, custom wallpaper, an invitation or more⁴
- HELP THAT KEEPS UP: Stay in the moment while Now Nudge with Galaxy AI helps you respond faster and stay organized with smart suggestions⁵ that appear exactly when you need them on your phone
Troubleshoot common screenshot problems
ChromeDriver rejects the device name
The profile name is not available to that ChromeDriver/Chrome version. Check the installed emulated-device list, update to a compatible setup if appropriate, or replace deviceName with explicit width, height, and pixelRatio metrics.
The page looks like desktop despite mobile dimensions
Confirm that mobileEmulation was added to Chrome options before constructing the driver, and verify the actual viewport width. If the site serves different content based on identity, its response may also depend on user-agent or client-hint settings.
The image is blank, incomplete, or missing images
Navigation may have finished before the relevant content rendered. Wait for a page-specific element or state before calling the screenshot method. For lazy-loaded images, the page may need scrolling or another site-specific interaction before those images appear; a viewport capture only records what is visible at capture time.
Recommended Free Tools
The screenshot excludes the bottom of the page
This is expected for a viewport screenshot. Use a full-page capability supported by your browser/WebDriver implementation when you need content outside the visible viewport, and verify the result rather than assuming the standard screenshot call expands the page.
Best Value
- Carrier: This phone is locked to Tracfone, which means this device can only be used on the Tracfone wireless network. Activating is easy, just 3 steps.
- ACTIVATION Promotion: Includes 1500 min, 1500 texts & 1500 MB Data + add more as you need it
- CAMERA SYSTEM: 50MP Quad Pixel camera. Capture sharper, more vibrant photos day or night with 4x the light sensitivity.
- PERFORMANCE: Blazing-fast Qualcomm performance. Get the speed you need for great entertainment with a Snapdragon 680 processor and 4GB of RAM.
- 64GB built-in storage. Get plenty of room for photos, movies, songs, and apps. Made for US
The output dimensions do not match expectations
Distinguish CSS viewport dimensions from the output image’s pixel dimensions: device pixel ratio affects scale. Check the configured metrics, orientation, and saved image dimensions, and make sure comparisons use the same viewport and ratio.
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF; see the API documentation for options and response details.
curl -G "https://api.screenshotneo.com/v1/shot"
-d access_key=YOUR_API_KEY
--data-urlencode url=https://example.com
-o shot.webp
ScreenshotNeo removes cookie/consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are not billed. Its MCP server lets AI agents take screenshots, and the free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for the free plan.
Frequently Asked Questions
Does Selenium’s standard screenshot call capture the full page?
No. The standard call captures the visible viewport; full-page support depends on the browser and WebDriver implementation.
Can a mobile-emulated screenshot prove how a site works on a real phone?
No. Emulation approximates mobile rendering and behavior. Use physical-device testing for hardware-dependent or device-specific behavior.
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.




