October 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 NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

How to Capture a Mobile Website Screenshot with WebdriverIO and Chrome

Use WebdriverIO device emulation with Chrome to capture a mobile viewport or full-page screenshot, with guidance on BiDi, visual stability, and real-device limits.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To capture a mobile website screenshot with WebdriverIO and Chrome, emulate a mobile device profile before opening the page, wait for the content you need, then save either the visible viewport or the full page. WebdriverIO’s browser.takeScreenshot() returns a base64-encoded PNG of the viewport; its Visual Testing service also provides file-saving methods for viewport and full-page captures. Desktop Chrome emulation is useful for responsive-layout checks, but it is not a substitute for testing on a real mobile browser.

Choose the screenshot you need

Decide the capture extent before writing the test: a viewport screenshot shows only the currently visible browser area, while a full-page screenshot includes content beyond the viewport. An element screenshot is limited to an element’s visible bounding rectangle after it is scrolled into view.

As an Amazon Associate I earn from qualifying purchases.

  • Viewport: Use browser.takeScreenshot() for base64 PNG data, or Visual Testing’s saveScreen() to save an image file.
  • Full page: Use Visual Testing’s saveFullPageScreen(). For content that loads or changes as the page scrolls, consider its user-based scrolling and stitching option.
  • One element: Use the WebDriver element screenshot command or Visual Testing’s saveElement().

The WebDriver Protocol documentation describes viewport and element screenshot behavior: WebdriverIO WebDriver Protocol.

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

Capture a mobile viewport screenshot with WebdriverIO

The example below uses WebdriverIO’s device emulation API to configure an iPhone 15 profile, navigate to a page, wait for its main content, and save the viewport as a PNG. It is a documented API pattern, not a claim that the snippet was run. Use an app-specific readiness condition where possible.

#1 Best Overall
Samsung Galaxy A17 5G Smart Phone 128GB US 1 Yr Manufacturer Warranty Black | Large AMOLED, High-Res Camera, Durable Design, Super Fast Charging, Expandable Storage, Circle to Search, 2025
  • 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.
  1. Start a Chrome session configured for WebDriver BiDi by setting webSocketUrl: true in the capabilities.
  2. Emulate the device before navigating so the page loads under the intended viewport, device scale factor, and user agent.
  3. Wait for meaningful page content, then capture and decode the base64 PNG.
  4. Restore the original settings in a finally block so they do not affect later tests.
// In a WebdriverIO test with a Chrome session configured for WebDriver BiDi:
const restoreDevice = await browser.emulate('device', 'iPhone 15')

try {
  await browser.url('https://example.com')
  // Replace this with an app-specific readiness condition where possible.
  await $('main').waitForDisplayed()

  const base64Png = await browser.takeScreenshot()
  await import('node:fs/promises').then(({ writeFile }) =>
    writeFile('./mobile-viewport.png', Buffer.from(base64Png, 'base64'))
  )
} finally {
  await restoreDevice()
}

browser.takeScreenshot() captures the top-level browsing context’s viewport and returns base64-encoded PNG data. The file is written relative to the test process’s working directory.

Save viewport or full-page images with Visual Testing

If your project uses WebdriverIO Visual Testing, its save methods write image files directly:

Rank #2
Tracfone Motorola Moto G 2025, 64GB, Saphire Blue (Locked to
  • 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.
await browser.saveScreen('mobile-homepage')
await browser.saveFullPageScreen('mobile-homepage-full')

saveScreen() saves a viewport image; saveFullPageScreen() saves a full-page image. Exact output locations and filename formatting depend on the service configuration. Use check methods instead when the aim is image comparison rather than simply saving a capture. See Visual Testing Methods.

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

When the page loads content while scrolling

A full-page capture that does not scroll through the page may miss content that is lazy-loaded or rendered based on scroll position. Visual Testing’s userBasedFullPageScreenshot service option scrolls through the page, captures viewport-sized images, and stitches them. Set the scroll timeout to suit the page, and confirm support for the browser and application context you use. See Visual Testing Service Options.

Rank #3
Sale
Samsung Galaxy A17 5G Smart Phone 128GB, US 1 Yr Manufacturer Warranty Blue | Large AMOLED, High-Res Camera, Durable Design, Super Fast Charging, Expandable Storage, Circle to Search, 2025
  • 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.

Understand what Chrome device emulation can—and cannot—verify

browser.emulate('device', 'iPhone 15') adjusts the viewport, device scale factor, and user agent. WebdriverIO’s documented device presets are maintained lists, so check the current list rather than assuming a preset or its specifications will remain unchanged. Device emulation requires WebDriver BiDi support; the browser session and any remote provider must support it.

This workflow produces a mobile-emulation screenshot using desktop Chrome. It does not reproduce every operating-system, browser-engine, font-rendering, or hardware detail of an actual phone. WebdriverIO’s Emulation documentation cautions that desktop browser engines differ from mobile ones and says the feature should not be treated as mobile testing. Chrome describes Device Mode as a first-order approximation; for device-specific validation, run the test on a real device or a real-device service. See Chrome DevTools: Simulate mobile devices with Device Mode.

Rank #4
Sale
Samsung Galaxy S26 Ultra, Unlocked Android Smartphone, 512GB, Black | Privacy Display, Galaxy AI, AI Camera, Super Fast Charging 3.0, Durable Battery, 2026, US 1 Year Warranty
  • 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

Make captures more repeatable

For a screenshot that reflects the page state you intend to inspect, wait for a meaningful application condition instead of relying only on a fixed delay. Depending on the page, that may mean waiting for a selector, images, or fonts to finish loading.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Fonts: Visual Testing includes waitForFontsLoaded, enabled by default, to reduce captures taken before fonts are ready.
  • Animations and cursors: Visual Testing options can disable CSS animations and blinking cursors. Apply the same settings when creating and comparing visual baselines.
  • Lazy content: If content appears only after scrolling, use user-based full-page capture and allow adequate time for the page’s scroll-triggered work.
  • Overlays and element captures: Element screenshots cover the visible region within the element’s bounding rectangle. Visual Testing’s BiDi biDiOrigin setting affects whether a capture reflects document layout or viewport compositing and overlays.

See Visual Testing Method Options for the relevant stability options.

Best Value
Tracfone Moto g Play 2024 Prepaid Phone with a 1-Yr Plan Included
  • 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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common screenshot problems

Symptom Likely cause What to do
Device emulation fails with a BiDi-related error The session does not advertise WebDriver BiDi, or the browser or remote provider does not support it. Enable webSocketUrl: true in capabilities and verify BiDi support across the browser and provider.
The image contains only the visible area browser.takeScreenshot() is a viewport capture. Use saveFullPageScreen() for a full-page image, or Chrome DevTools’ full-size screenshot capture.
Content below the fold is missing The page loads content only after scrolling, or rendering depends on scroll position. Use userBasedFullPageScreenshot: true and allow an appropriate scroll timeout.
Fonts or animation frames differ between captures The page was captured before fonts finished loading, or animations and blinking cursors were in different states. Use the Visual Testing font and animation options consistently for captures and comparisons.
An element image is clipped or includes unexpected overlays Element screenshots capture the visible bounding rectangle; BiDi origin settings can change the treatment of layout and overlays. Check the element’s visibility and position, then review the Visual Testing biDiOrigin option for the capture you need.
Image resolution or quality changes after switching methods Visual Testing’s enableLegacyScreenshotMethod switches to the older W3C WebDriver screenshot method, which may produce a different resolution or quality. Keep the method consistent for comparable captures and check the active service configuration.

Or skip the browser setup

For a one-request website screenshot, ScreenshotNeo accepts a URL and returns an image or PDF. This cURL example saves a WebP image:

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

See the ScreenshotNeo API documentation for setup and request options. ScreenshotNeo accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. An 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 screenshots. Learn more at ScreenshotNeo.

Sign up free for 1,000 screenshots a month, with no card required.

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

Frequently Asked Questions

Does browser.takeScreenshot() save an image file?

No. It returns base64-encoded PNG data; decode it and write the bytes to a file, as in the example.

Can I call the emulation preset after opening the page?

Set the device context before navigation so the page loads with the emulated viewport and user agent.

Can I use the iPhone 15 preset with a remote Chrome provider?

Only if the provider supports WebDriver BiDi for the session. Confirm support with the provider and check WebdriverIO’s current device list for available presets.

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.

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

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
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.