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

Mount Google Drive in your Colab notebook, save Selenium’s PNG screenshot to a path under /content/drive/MyDrive/, and check the method’s return value. The documented workflow is the same for readers in India; the official sources reviewed do not specify a separate India-only procedure.

Save a Selenium screenshot directly to Google Drive

Run the following cells in order. This example saves the current browser window as page.png in a folder named selenium_screenshots in your Drive.

  1. Mount Drive: Run this cell and complete Colab’s authorization prompt.
from google.colab import drive
drive.mount('/content/drive')

Colab documents mounting Drive in the runtime so notebook code can access files, including writing files. Mounting gives notebook code access to Drive, so only run code you trust. Google Colab: Accessing Google Drive files

  1. Initialize Selenium and load the page: Use the browser and driver setup appropriate to your notebook environment. Navigate to the target URL, then wait for the page or element you need before capturing it.

The browser-installation and wait code depends on the Colab runtime and target site. The example below assumes driver has already been created and the page is ready.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
HP 14" HD Chromebook Laptop for Students, Intel Quad-Core N4120(> N4020), 4GB RAM, 64GB eMMC, WiFi, Webcam, HDMI, USB-A&C, 14 Hours Battery Life, Zoom, Chrome OS, CUE Accessories
  • Intel Celeron N4120: 4 Cores & Threads, 1.1GHz Base Clock, Up to 2.6GHz Boost Clock, 4MB Cache, Intel UHD Graphics 600. The perfect combination of performance, power consumption, and value helps your device handle multitasking smoothly and reliably with four processing cores to divide up the work.
  • 14" HD Display: 14.0-inch diagonal, HD (1366 x 768), micro-edge, anti-glare. See your digital world in a whole new way. Enjoy movies and photos with the great image quality and high-definition detail of 1 million pixels.
  • Memory & Storage: 4 GB LPDDR4x & 64 GB eMMC Storage. Adequate high-bandwidth RAM to smoothly run multiple applications and browser tabs all at once. An embedded multimedia card provides reliable flash-based storage.
  • Ports:2 x USB 3.0 Type-A,1 x USB 3.0 Type-C,1 x HDMI,1 x Headphone Jack
  • Chrome OS: Chromebook is a computer for the way the modern world works, with thousands of apps. Enjoy the seamless simplicity that comes with Google Chrome and Android apps, all integrated into one laptop. It’s fast, simple, and secure.
  1. Create a Drive folder, save the screenshot, and verify success:
from pathlib import Path

output_dir = Path('/content/drive/MyDrive/selenium_screenshots')
output_dir.mkdir(parents=True, exist_ok=True)
screenshot_path = output_dir / 'page.png'

saved = driver.save_screenshot(str(screenshot_path))
if not saved:
    raise IOError(f'Could not save screenshot to {screenshot_path}')

print(f'Screenshot saved to {screenshot_path}')

Selenium’s save_screenshot(filename) saves the current window as a PNG and expects a full path. It returns False if an I/O error occurs. Keep the filename extension as .png to match that output. Selenium WebDriver API: save_screenshot

Make sure the captured page is the one you want

save_screenshot() captures the browser’s current window; it does not itself navigate, wait for an application to finish rendering, or select a particular element. Navigate first and wait for content that matters to appear. A fixed delay can be suitable for a simple page, but waiting for a specific element is generally more reliable when the page loads dynamically.

Because browser setup varies by Colab runtime and site, confirm that your Selenium driver is working and that the target content is visible before saving. The code above is the Drive-writing portion, not a claim that one browser installation recipe works in every Colab session.

Choose the right destination and write strategy

Approach Use it when Important detail
Mounted Drive filesystem You want a simple path-based workflow and screenshots to remain in Drive. Write under /content/drive/MyDrive/. Drive operations rely on the Colab runtime and can be slow or quota-limited. Google Colab FAQ
PyDrive2 or Drive REST API Drive mounting is unsupported or an API-oriented workflow better fits your needs. Colab lists these as alternative Drive access methods; they require a different workflow from saving to a mounted filesystem. Google Colab: Accessing Google Drive files
Download from the runtime You want the file on your local computer rather than in Drive. Colab documents files.download(...) for downloading a runtime file. Google Colab: Accessing Google Drive files

Handle slow or repeated screenshot writes

Drive storage may be geographically far from the Colab runtime, and Google notes that Drive operations can be slow. The runtime is also the intermediary for mounted-folder operations; do not treat a runtime-local path such as /content/page.png as persistent Drive storage.

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.
Rank #3
ASUS 2026 15" FHD IPS Chromebook, Intel Processor Up to 2.80GHz, 4GB DDR4, 128GB Storage, HDMI, Super-Fast WiFi, Chrome OS, Pastel Blue, Renewed
  • Intel Processor Up to 2.80GHz, 4GB DDR4, 128GB Storage
  • 15" FHD IPS Display, Intel UHD Graphics
  • 1x USB Type C, 1 x USB Type A, 1x Headphone/Microphone Combo Jack, HDMI
  • Super Fast WiFi and Bluetooth, Integrated Webcam
  • Chrome OS, AC Charger Included, Pastel Blue

If you generate many screenshots and Drive writes are slow or encounter quota-related I/O errors, one practical approach is to save screenshots to runtime-local storage first, then copy them to Drive in fewer operations. This batching approach follows Google’s advice to reduce reads and writes to Drive; it is not a documented guarantee against quotas or failures. For the simplest workflow, write directly to the mounted Drive path as shown above.

Troubleshooting

  • The mount prompt does not appear or mounting is unsupported: Confirm you are using a Colab environment that supports drive.mount(). The Colab implementation marks mounting as unsupported in Colab Enterprise and points to PyDrive2; Colab’s I/O notebook also lists PyDrive2 and the native REST API as alternatives. Colab Drive implementation
  • The save call returns False: Treat it as a screenshot I/O error. Check that Drive is mounted, the destination is under the mounted path, the folder can be created, and the filename is a full path. Selenium documents the return value and full-path requirement in its WebDriver API.
  • The file is missing after the runtime ends: Check that the path starts with /content/drive/MyDrive/, rather than a runtime-local directory. Mounted Drive is accessed through the runtime, and temporary runtime storage should not be treated as persistent Drive storage. Google Colab FAQ
  • Drive writes are unusually slow or fail during a large batch: Reduce the number of reads and writes to Drive, for example by capturing locally and copying files in a batch. Quotas may also cause I/O errors; batching is a mitigation idea, not a promise that quota limits will disappear. Google Colab FAQ
  • The screenshot is blank or misses page content: Check that Selenium navigated to the intended URL and that the relevant content finished loading before the save call. The screenshot method captures the current window; it does not wait for a site-specific readiness condition.
  • Access is blocked for an account or notebook: The official documentation reviewed does not establish India-specific account or organization-policy rules. Check your Google account access and ask your organization administrator if a managed account blocks Drive access.
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 your goal is simply to capture a webpage rather than automate it through Selenium in Colab, ScreenshotNeo offers a one-request screenshot API. See the ScreenshotNeo API documentation for request options.

Best Value
Rank #4
Sale
Lenovo Chromebook 2-in-1 - Lightweight Laptop - Google Gemini - Intel® N150 CPU - 14" WUXGA IPS Touchscreen Display - 4GB RAM - 128GB UFS Storage - Integrated Intel® Graphics - Luna Grey
  • THE BETTER WAY TO LAPTOP – Imagine a Chromebook that’s as flexible as your day: thin and lightweight with built-in Google apps and stress-free security.
  • TAKE HITS KEEP MOVING – Sleek, light, and built to last- the Chromebook 2-in-1 is just 0.69” thick and 3.3lbs. Enjoy long-lasting battery life, fast charging, and military-grade durability for nonstop productivity wherever life takes you.
  • PERFORMANCE THAT MATCHES YOUR HUSTLE – Fuel your ideas with an Intel Core processor and 128GB storage. Boot up in under 10 seconds to start the day powerfully efficient.
  • FLEX YOUR CREATIVITY ANYWHERE, ANYTIME – Create, work, or unwind your way with a versatile 2-in-1 design. Flip easily between laptop, tent, and tablet modes with a responsive touchscreen built for flexibility.
  • BRILLIANT VIEWS AND IMMERSIVE AUDIO – See, hear, and create with awesome clarity. The WUXGA display brings rich detail to your work and play, while audio tuned by Waves MaxxAudio provides immersive, balanced sound.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo accepts consent banners before capture and removes 60+ known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server provides screenshot tools for AI agents, including Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan.

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.