chromium.connectOverCDP() connects Playwright to an already running Chromium-based browser; it does not, by itself, connect to Chrome on an Android phone. For actual Android hardware, use Playwright’s separate experimental Android API, which works through ADB. Device emulation is a third option: it simulates selected mobile browser settings but does not exercise physical hardware.
Choose the Playwright path that matches your target
| Path | What it connects to or changes | Best fit | Important qualification |
|---|---|---|---|
chromium.connectOverCDP() |
An existing Chromium-based browser exposed through a Chrome DevTools Protocol (CDP) HTTP or WebSocket endpoint. | Automating or inspecting a running desktop Chromium browser. | Playwright documents this as significantly lower fidelity than its own protocol connection. BrowserType API |
| Playwright Android API | Chrome for Android or Android WebView on an Android device or AVD emulator, using ADB. | Testing through an Android browser or WebView, including on physical Android hardware. | Android automation is experimental and has documented operational limitations. Android API |
| Device emulation | Selected browser settings, such as user agent, viewport, screen dimensions and touch behavior. | Checking responsive layouts and simulated mobile behavior. | Emulation is not a test on an actual phone. Emulation guide |
These routes solve related but different problems. A CDP endpoint is a way to attach to an already running Chromium browser; it is not a synonym for Android device testing. If you want actual hardware behavior, start with the Android API and its ADB requirements.
Attach to an existing Chromium browser with CDP
Use connectOverCDP() when a Chromium-based browser is already running and has exposed a CDP endpoint. The endpoint can be an HTTP URL such as http://localhost:9222 or a CDP WebSocket URL. After connection, inspect the browser’s existing contexts and pages rather than assuming a fresh page was created.
Example using a CDP endpoint
import { chromium } from 'playwright';
const browser = await chromium.connectOverCDP('http://localhost:9222');
try {
const contexts = browser.contexts();
const context = contexts[0];
if (!context) {
throw new Error('The connected browser has no accessible context.');
}
const pages = context.pages();
const page = pages[0];
if (!page) {
throw new Error('The connected context has no open page.');
}
console.log('Current page:', page.url());
await page.screenshot({ path: 'connected-browser.png' });
} finally {
await browser.close();
}
Replace the endpoint with the address or WebSocket URL exposed by your running browser. The example deliberately checks for a context and page instead of silently assuming either exists. Use the connection only for functionality supported through CDP: Playwright warns that it is significantly lower fidelity than the Playwright-protocol connection available through browserType.connect(). If you encounter unsupported behavior or need higher fidelity, use that protocol-based connection where your setup permits it. Playwright BrowserType API
#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.
Automate Chrome on a real Android device
For Android hardware, use Playwright’s Android API, not connectOverCDP(). The API can discover Android devices through ADB, launch Chrome, create a page in its context, navigate and take a screenshot. Playwright describes Android automation as experimental support. Android API
Prerequisites
- An Android device or Android Virtual Device (AVD) emulator.
- ADB installed and authenticated so the device is available to the development machine.
- Chrome 87 or newer on the Android target.
- The Chrome flag setting specified in the Playwright Android API documentation.
Follow the current setup instructions and flag name in the official Android API documentation; do not substitute a desktop Chrome remote-debugging setup for the documented Android procedure.
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.
Example: discover a device, launch Chrome and capture a page
import { _android as android } from 'playwright';
const devices = await android.devices();
if (devices.length === 0) {
throw new Error('No Android device found through ADB.');
}
const device = devices[0];
console.log('Connected device:', device.model());
const context = await device.launchBrowser();
try {
const page = await context.newPage();
await page.goto('https://example.com');
await page.screenshot({ path: 'android-chrome.png' });
} finally {
await context.close();
await device.close();
}
This follows the Android API’s device-discovery and browser-launch workflow. Check the API documentation for the current method signatures and any setup changes for your installed Playwright version. A successful run exercises the Android Chrome path, but does not establish that every test or device feature is supported.
Know the Android API limitations
- Playwright says raw USB operation is not supported by this API; do not assume that plugging in a phone alone completes device access.
- The device must be awake for screenshots.
- Playwright notes that not all tests were run against the device.
- The API is experimental, so confirm that its current support and limitations fit your test plan before relying on it.
When device emulation is enough
Emulation is useful when the question is whether a page responds correctly to a mobile-sized viewport, user agent or touch setting. It is quicker to apply than connecting hardware and can help cover multiple simulated configurations. It cannot validate actual device hardware or prove that behavior matches a particular physical phone. See Playwright’s emulation guide for the parameters it can configure.
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.
Troubleshoot connection and capture problems
| Symptom | Likely cause | What to check |
|---|---|---|
connectOverCDP() cannot connect |
The target browser is not running with a reachable CDP endpoint, or the endpoint is incorrect or inaccessible. | Confirm the browser exposes CDP, use the actual HTTP or WebSocket endpoint, and verify that the process running Playwright can reach it. |
| No context or open page is available | The connected browser does not have the context or page your script expects. | Inspect browser.contexts() and each context’s pages(); open or select the intended page rather than assuming a new one exists. |
| CDP-connected behavior differs from normal Playwright runs | CDP attachment has lower fidelity than the Playwright protocol connection. | Check whether the feature is supported in this connection mode; consider browserType.connect() if your environment supports it. |
| No Android devices are discovered | ADB is unavailable, the device is not authenticated, or the Android target is not set up as documented. | Verify ADB access and authentication, then follow the current setup steps in the Android API documentation. |
| Android Chrome will not launch | The Chrome version or required flag setting may not meet the documented prerequisites. | Check that the target has Chrome 87 or newer and apply the Chrome flag setting specified in the Playwright documentation. |
| Android screenshot is blank or unavailable | The device may not be awake; screenshots require an awake device. | Wake and unlock the device, then retry the capture. |
| A test works in emulation but not on a phone | Emulation changes selected browser settings but does not reproduce all physical-device conditions. | Run the test through the Android API on a device or AVD when actual Android browser behavior is essential. |
Or skip the browser setup
If your goal is a clean screenshot or PDF of a page rather than interactive testing on a device, ScreenshotNeo provides a website screenshot API and MCP server. A single GET request can return a PNG, JPEG, WebP or PDF. It does not replace Playwright tests or real-device validation.
For example, this cURL request saves a WebP screenshot of Stripe. See the ScreenshotNeo API documentation for options and response details.
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
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 cookie or 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 cost nothing, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info and capture_pdf tools for AI agents. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month without a card.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Frequently Asked Questions
Does connectOverCDP() connect directly to a physical Android phone?
No. It attaches to an existing Chromium browser through a CDP endpoint. Playwright’s separate Android API is the documented path for Android device automation.
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 use an Android emulator instead of a physical phone?
Yes. The Android API prerequisites allow an Android Virtual Device emulator as well as an Android device.
Does device emulation count as real-device testing?
No. It simulates selected browser parameters; it does not exercise actual phone hardware.
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.
Free tools Windows power users keep installed
One-click scans. No signup required.

