Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsWait for the download before triggering the export, save it before the browser context closes, and treat the browser and the file transfer as separate concerns. Playwright gives you a first-class download event and a deterministic saveAs step. Selenium can start a download, but its ordinary API does not report progress, so an HTTP client or Selenium Grid’s managed-download feature is often more reliable—especially on remote machines.
Choose the transfer strategy first
Your best approach depends on whether you need to reproduce the user interface or only obtain the CSV.
| Situation | Recommended approach | Reason |
|---|---|---|
| Playwright, local or remote browser | Wait for the download event, click, then call saveAs |
Playwright exposes the completed download as a Download object. |
| Selenium, browser behavior must be tested | Configure a download directory and wait for the file to finish | This reproduces the UI, but Selenium’s standard API does not expose download progress. |
| Selenium, large export or reliable retries needed | Use Selenium to authenticate and discover the export URL, then transfer it with an HTTP client | HTTP clients provide clearer status, timeout, retry and streaming controls. |
| Remote Selenium Grid | Use managed downloads and transfer the selected remote file | The file normally exists on the Grid node, not on the test runner. |
Whichever method you use, validate the result as data: check the HTTP status, content type, encoding, header row and expected columns before handing it to downstream code.
Playwright: synchronize before clicking
Register the waiter before the action that starts the export. Registering it afterward creates a race: a fast response can emit the event before your code begins waiting.
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
JavaScript (Node.js)
import { chromium } from 'playwright';
const browser = await chromium.launch();
const context = await browser.newContext({
acceptDownloads: true
});
const page = await context.newPage();
try {
await page.goto('https://example.com/reports', { waitUntil: 'networkidle' });
// Sign in or set up filters here.
const downloadPromise = page.waitForEvent('download');
await page.getByRole('button', { name: /export csv/i }).click();
const download = await downloadPromise;
console.log('Suggested name:', download.suggestedFilename());
console.log('Download URL:', download.url());
await download.saveAs('/data/exports/report.csv');
} finally {
await context.close();
await browser.close();
}
Playwright emits a download event for every attachment downloaded by the page. Keep the context open until saveAs completes: downloaded files are deleted when their producing context closes. The temporary path is an implementation detail; use suggestedFilename() for a server-provided name or choose an application-defined path.
Python
from pathlib import Path
from playwright.sync_api import sync_playwright
output = Path('/data/exports/report.csv')
output.parent.mkdir(parents=True, exist_ok=True)
with sync_playwright() as p:
browser = p.chromium.launch()
context = browser.new_context(accept_downloads=True)
page = context.new_page()
try:
page.goto('https://example.com/reports', wait_until='networkidle')
with page.expect_download() as download_info:
page.get_by_role('button', name='Export CSV').click()
download = download_info.value
print(download.suggested_filename())
print(download.url)
download.save_as(str(output))
finally:
context.close()
browser.close()
For an unknown trigger, a page-level download listener can observe events, but do not leave the listener unawaited: the scenario can finish while the file is still being written.
Waiting for an export job
Some applications first create an export job and only later expose a download. In that case, wait for the application’s completion indicator or download control, then use the same event-before-click pattern. A fixed sleep is a fallback, not synchronization: it is either wastefully long or too short for a busy export.
Selenium: reproduce the browser save
Selenium’s documented limitation is important: its standard API can start a download, but does not expose download progress. That makes a browser-only assertion less deterministic than Playwright’s download object or an HTTP transfer.
Local Selenium with a controlled directory
from pathlib import Path
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
out = Path('/data/exports')
out.mkdir(parents=True, exist_ok=True)
options = webdriver.ChromeOptions()
options.add_experimental_option('prefs', {
'download.default_directory': str(out.resolve()),
'download.prompt_for_download': False,
'download.directory_upgrade': True,
})
driver = webdriver.Chrome(options=options)
try:
driver.get('https://example.com/reports')
# Authenticate and set filters here.
driver.find_element(By.CSS_SELECTOR, '[data-export="csv"]').click()
deadline = time.time() + 120
while time.time() < deadline:
partial = list(out.glob('*.crdownload'))
csv_files = list(out.glob('*.csv'))
if csv_files and not partial:
newest = max(csv_files, key=lambda p: p.stat().st_mtime)
print(newest)
break
time.sleep(0.5)
else:
raise TimeoutError('CSV download did not finish')
finally:
driver.quit()
The partial-extension check is browser-specific and should be adapted to the browser you run. Prefer an application-defined filename or a run-specific empty directory so an older CSV cannot satisfy the check.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Selenium: transfer the export with an HTTP client
When progress, retries, streaming or very large files matter, let Selenium establish the authenticated session and locate the export link. Then copy the session cookies into an HTTP request. This avoids relying on the browser’s download UI while preserving the login state.
import csv
from pathlib import Path
import requests
from selenium import webdriver
from selenium.webdriver.common.by import By
out = Path('/data/exports/report.csv')
driver = webdriver.Chrome()
try:
driver.get('https://example.com/reports')
# Complete login and filters first.
export = driver.find_element(By.CSS_SELECTOR, 'a[data-export="csv"]')
export_url = export.get_attribute('href')
if not export_url:
raise RuntimeError('Export link has no URL')
session = requests.Session()
for cookie in driver.get_cookies():
session.cookies.set(cookie['name'], cookie['value'], domain=cookie.get('domain'), path=cookie.get('path', '/'))
with session.get(export_url, stream=True, timeout=120) as response:
response.raise_for_status()
content_type = response.headers.get('Content-Type', '')
if 'csv' not in content_type.lower() and 'text' not in content_type.lower():
raise ValueError(f'Unexpected content type: {content_type}')
out.parent.mkdir(parents=True, exist_ok=True)
with out.open('wb') as fh:
for chunk in response.iter_content(chunk_size=1024 * 1024):
if chunk:
fh.write(chunk)
finally:
driver.quit()
with out.open(newline='', encoding='utf-8-sig') as fh:
reader = csv.DictReader(fh)
required = {'id', 'created_at'}
if not required.issubset(reader.fieldnames or set()):
raise ValueError('CSV is missing required columns')
The exact request may require more than cookies: a CSRF token, an Authorization header, a POST body, or a particular Referer. Capture those values from the authenticated page or application rather than assuming the visible URL is sufficient. Do not copy secrets into logs.
Remote Selenium and managed downloads
With a remote WebDriver session, the browser’s download directory is on the remote computer. Polling a directory on your laptop will therefore find nothing. Selenium Grid documents managed downloads: enable the feature in the Grid and the client capability, list downloadable files after the export, then invoke the file-download operation to transfer the selected file to the client or a target directory. Keep the file identifier returned by the Grid and verify that the transferred bytes are the expected CSV.
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 reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchIf managed downloads are unavailable, use the authenticated-HTTP pattern instead: obtain the export URL and cookies from the remote session, then perform the transfer from a process that can reach the application.
Filenames, URLs and the HTML download attribute
Do not build correctness around a temporary browser filename. A suggested name can come from the response’s Content-Disposition header or the HTML download attribute. The URL path and media type may also influence it. Save to a deterministic path when your pipeline needs a stable name, and retain the suggested name only as metadata.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
The HTML download attribute is not universal: it works for same-origin URLs and for blob: or data: URLs. Browser settings and Content-Disposition can override both whether a download occurs and which name is used. Cross-origin export links may therefore open in a tab or require server-side headers.
Reliability and performance controls
- Use explicit timeouts: set a navigation timeout and a separate export timeout appropriate to the largest expected report.
- Stream large files: HTTP
stream=Trueprevents the entire CSV from being held in memory. - Retry safely: retry network failures and transient 5xx responses, but avoid blindly repeating a non-idempotent export request.
- Isolate runs: use a unique output directory or filename so stale files cannot pass a test.
- Preserve context: do not close the Playwright context or remote session until persistence or transfer is complete.
- Validate content: reject login HTML, JSON error bodies, truncated files, unexpected encoding, missing headers or an unexpected column count.
- Control concurrency: exporting many reports at once can exhaust browser memory, server limits or disk space; cap workers and monitor free space.
Troubleshooting common failures
No download event
Register the waiter before the click, confirm the locator activates the export control, and check whether the application opens a new tab or creates an asynchronous job instead of attaching a file.
Recommended Free Tools
The saved file disappears
You likely closed the Playwright context first. Await saveAs (or copy the stream) before closing it.
The file is HTML instead of CSV
The session probably lost authentication or received a consent, login or error page. Check status, final URL, content type and the first bytes before parsing.
Selenium cannot find the downloaded file
Confirm the configured directory, wait for the browser’s partial file to disappear, and remember that a remote browser writes on the remote node. Use Grid managed downloads or an HTTP client.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Filename changes between runs
Server headers, the HTML attribute or generated report names may differ. Persist to your own path and use the suggested name only for display.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Direct HTTP request returns 403
Cookies alone may not be enough. Transfer required authorization and CSRF values, preserve the method and body used by the export request, and respect the application’s access controls.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
If your goal is a visual record of the report page rather than the CSV bytes, ScreenshotNeo makes one GET request for a screenshot or PDF. Its cleanup step accepts cookie banners and removes more than 60 known consent platforms, newsletter popups and chat widgets before capture; each step can be disabled. Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits cost nothing, and the response identifies the result with X-Page-Verdict and X-Billed headers.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/reports -o report.webp
See the ScreenshotNeo documentation for the 63 capture options, including full-page lazy-image loading, CSS-element capture, custom JavaScript, waits, request blocking, cookies and headers, PDFs, signed links, asynchronous jobs, bulk capture and usage reporting. An MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients.
ScreenshotNeo is not a CSV downloader; use the browser or HTTP patterns above for export bytes. It is useful when you need a clean visual audit of the export screen without setting up a browser. Create a free ScreenshotNeo account: 1,000 screenshots per month, no card required; paid plans start at $5 for 3,000.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →FAQ
Should I click the export button or call its URL?
Click when you must test the user journey or the export request depends on browser state. Call the URL with an authenticated HTTP client when deterministic transfer and progress matter more than browser fidelity.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Can I rely on the HTML download attribute?
Only within its origin and scheme limits. Same-origin, blob: and data: URLs are supported, while headers and browser settings can override the result.
Why is my remote download missing locally?
The browser saved it on the remote node. Enable managed downloads and transfer the file, or perform the authenticated request from the client.
Frequently Asked Questions
How do I prevent a fast CSV export from racing my test?
Create the Playwright download waiter before clicking the export control, then await both the event and the save operation.
What should I log for a failed export?
Record the status, final URL, content type, byte count, suggested filename and validation error, while redacting cookies and authorization data.
The Bottom Line
For Playwright, wait first and save before closing the context. For Selenium, use a controlled directory for UI fidelity, or transfer the authenticated export URL with an HTTP client when reliability and progress are the priority. Remote sessions require managed-download transfer or an HTTP request from the right network location.
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.

