Use Chromium’s mobile-emulation setting before you create the WebDriver session. Then navigate, wait for the page state you need, and call Selenium’s screenshot method. You can select a named device profile or provide explicit viewport metrics such as width, height, and pixel ratio. This produces a mobile-emulated Chrome screenshot for responsive-layout checks; it does not prove that the page behaves identically in a physical iPhone or Android browser.
What Selenium mobile emulation actually changes
Chrome mobile emulation changes the browser context used by your desktop WebDriver session. Depending on the options exposed by your language binding, you can set viewport width and height, device pixel ratio, user-agent information, and touch behavior. Responsive breakpoints, CSS media queries, and many layout decisions can therefore be checked without connecting a handset.
It is still emulation. Native browser differences, operating-system behavior, hardware acceleration, mobile text rendering, sensor APIs, keyboard behavior, and vendor-specific bugs require a real device or a platform simulator. Selenium’s older mobile documentation treats Android and iOS devices and their emulators or simulators as a separate testing path.
Prerequisites and version checks
- Install Selenium for the language you use and a Chromium-based browser.
- Use a ChromeDriver compatible with the browser’s major version. Selenium’s Chrome documentation states that Selenium 4 is compatible with Chrome 75 and later by default and advises matching Chrome and ChromeDriver major versions; verify the versions in your own environment because browser and binding releases change.
- Choose the mobile metrics before constructing the driver. Changing them after the session starts is not the normal Options API workflow.
When startup fails, print the browser version and the driver version from your environment first. A mismatch is more actionable than changing screenshot code at random.
Free tools Windows power users keep installed
One-click scans. No signup required.
#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.
Choose a named profile or custom metrics
| Approach | Best for | Advantages | Watch-outs |
|---|---|---|---|
| Named device profile | A quick check against a recognizable device preset | Convenient dimensions and emulation settings supplied by the browser | The profile name must exist in the browser/driver setup; available profiles can change between versions |
| Custom device metrics | Tests whose viewport assumptions must be explicit and reviewable | You control width, height and pixel ratio directly | Those metrics describe a test viewport, not complete physical-device fidelity |
Use a named profile when its preset matches the target you document. Use custom metrics when a regression test must state exact dimensions. Selenium’s JavaScript example uses width 360, height 640 and pixel ratio 3.0 as an example configuration, not as a universal recommendation.
Python: configure emulation and save a screenshot
This example uses custom metrics, waits for the document to finish loading, and writes a PNG. Adjust the wait for your application rather than assuming that network completion means the UI is ready.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
options = Options()
options.add_experimental_option("mobileEmulation", {
"deviceMetrics": {
"width": 360,
"height": 640,
"pixelRatio": 3.0
}
})
driver = webdriver.Chrome(options=options)
try:
driver.get("https://example.com")
WebDriverWait(driver, 30).until(
lambda d: d.execute_script("return document.readyState") == "complete"
)
# Replace this with an application-specific readiness condition when needed.
driver.save_screenshot("mobile-emulated.png")
finally:
driver.quit()
The screenshot method captures the current viewport in the Python binding. Full-page output, image format, and element-capture behavior vary by binding and driver; consult the versioned Selenium API for the method you select instead of assuming that every binding implements the same extensions.
Python with a named profile
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_experimental_option("mobileEmulation", {
"deviceName": "Nexus 5"
})
driver = webdriver.Chrome(options=options)
try:
driver.get("https://example.com")
driver.save_screenshot("profile.png")
finally:
driver.quit()
Use a device name supported by the Chrome version running in your environment. If Chrome rejects the name, switch to custom metrics or choose a profile shown by that browser’s current DevTools device list.
Recommended Free Tools
JavaScript: use setMobileEmulation
In Selenium’s JavaScript Chromium API, the documented method is setMobileEmulation. Call it on the options object before creating the driver.
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.
const {Builder} = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
(async function () {
const options = new chrome.Options();
options.setMobileEmulation({
deviceMetrics: { width: 360, height: 640, pixelRatio: 3.0 }
});
const driver = await new Builder()
.forBrowser('chrome')
.setChromeOptions(options)
.build();
try {
await driver.get('https://example.com');
await driver.wait(async () =>
await driver.executeScript('return document.readyState') === 'complete',
30000
);
await driver.takeScreenshot().then(data =>
require('fs').writeFileSync('mobile-emulated.png', data, 'base64')
);
} finally {
await driver.quit();
}
})();
Binding syntax differs across Selenium releases. Keep the emulation call before build(), and check the current JavaScript API if your installed version names a method differently.
Other binding patterns
Java
ChromeOptions options = new ChromeOptions();
Map<String, Object> metrics = new HashMap<>();
metrics.put("width", 360);
metrics.put("height", 640);
metrics.put("pixelRatio", 3.0);
Map<String, Object> emulation = new HashMap<>();
emulation.put("deviceMetrics", metrics);
options.setExperimentalOption("mobileEmulation", emulation);
WebDriver driver = new ChromeDriver(options);
try {
driver.get("https://example.com");
((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
} finally {
driver.quit();
}
.NET
The .NET Chromium options API documents dimensions, pixel ratio, UserAgent, and EnableTouchEvents. Its settings class documents touch events as enabled by default. Do not transfer that exact default to another language binding without checking its reference.
var options = new ChromeOptions();
options.EnableMobileEmulation("Nexus 5");
using var driver = new ChromeDriver(options);
driver.Navigate().GoToUrl("https://example.com");
driver.GetScreenshot().SaveAsFile("mobile-emulated.png");
If you need a custom .NET configuration, use the mobile-emulation options type documented for the Selenium version you installed and set the metrics, user agent, and touch behavior explicitly.
Crashes, 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 minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Wait for the state that matters
document.readyState only indicates that the document load event has completed. Modern applications can still be rendering data, images, menus, or fonts. Prefer an explicit wait for a meaningful selector:
from selenium.webdriver.common.by import By
WebDriverWait(driver, 30).until(
lambda d: d.find_element(By.CSS_SELECTOR, "main[data-loaded='true']")
)
- Wait for a stable application marker, not an arbitrary long sleep.
- Scroll or interact before capture when lazy content appears only after user action.
- Hide test-only overlays or dismiss consent UI only when that behavior is part of the test you intend to record.
- Record the URL, viewport metrics, browser version, and commit alongside the image so a visual change is reproducible.
Viewport emulation versus a real device
| Question | Desktop Chrome emulation | Real phone or simulator |
|---|---|---|
| Responsive layout and CSS breakpoints? | Well suited for fast checks | Also possible, with more setup |
| Exact mobile OS/browser behavior? | Not established | Appropriate evidence |
| Physical touch, keyboard, sensors and hardware? | Only the emulated capabilities you configure | Tests actual platform behavior |
| Maintenance burden? | Usually a simple WebDriver session | Requires device, simulator or device-lab management |
Do not describe an emulated PNG as proof that Safari on iOS or Chrome on Android produced the same pixels. When platform fidelity is the requirement, run Selenium tests on real mobile devices or an appropriate simulator.
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.
Why Chrome Options is the normal choice
Selenium recommends Chrome Options for ordinary Chrome mobile emulation and generally prefers it over setting device metrics through the Chrome DevTools Protocol (CDP). Selenium describes CDP as temporary, version-dependent support pending broader WebDriver BiDi implementation. Its CDP documentation warns: “This is not designed for testing, nor to have a stable API, so functionality is highly dependent on the version of the browser.”
Use CDP only as a specialized fallback when a capability you need is not exposed by your binding’s Options API, and pin and verify browser versions if you do. WebDriver BiDi is the W3C-standard bidirectional direction Selenium identifies as the cross-browser replacement for CDP; implementation details continue to evolve.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteCommon failures and fixes
Session will not start
Cause: Chrome and ChromeDriver major versions do not match, or the driver is not on the path. Fix: inspect both versions, install a compatible driver, and retry with a minimal non-emulated session to isolate setup from emulation.
Unknown device name
Cause: the profile is unavailable in this Chrome build. Fix: use the current DevTools device list or replace the profile with explicit width, height, and pixelRatio.
Layout is desktop-sized
Cause: mobile emulation was added after driver creation, the wrong options object was passed, or the page cached a desktop decision before navigation. Fix: set options before session construction, create a fresh driver, and navigate only after it starts.
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
Screenshot is taken too early
Cause: the load event fired before client-side rendering completed. Fix: wait for a stable selector or application-ready flag.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Images or sections are missing
Cause: lazy loading waits for scrolling or intersection with the viewport. Fix: scroll deliberately, wait for image completion, and capture the state your test specifies.
Touch or user-agent assumptions fail
Cause: support and defaults differ by binding. Fix: configure user agent and touch behavior explicitly where the binding documents them, then verify the resulting values in the page.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server if you need a captured page rather than a Selenium test session. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be disabled. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and responses identify the page verdict and billing status in X-Page-Verdict and X-Billed headers. Its MCP server provides take_screenshot, get_page_info and capture_pdf for Claude, Cursor and other MCP clients.
For a one-call screenshot, see the ScreenshotNeo documentation:
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo also supports custom viewport and device settings, full-page capture with lazy images loaded, CSS-selector element capture, dark mode, retina scale, PDF options, custom CSS and JavaScript, click and wait actions, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage reporting and an OpenAPI specification. Parameter names used by other screenshot APIs are accepted to ease migration.
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 Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 screenshots; every feature is available on every plan. Create a free ScreenshotNeo account.
FAQ
Does mobile emulation test Safari?
No. It tests an emulated Chromium context. Use an iOS device or simulator for Safari-specific behavior.
Should I always use a named phone profile?
No. Custom metrics are preferable when exact viewport assumptions are part of the test contract.
Can I change emulation during one session?
Plan each target as a separate driver session unless your binding explicitly documents a supported runtime change.
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.

