← All posts

Test Mobile Web with Playwright on a Real Cloud Android Phone (2026)

Nov 11, 2026 · By Xavier Fok

Your Playwright mobile suite goes green, you ship, and then a real user on a real phone hits a layout that never showed up in your tests. The reason is the thing almost everyone gets wrong. You set a mobile viewport, you flip the touch flag, and you tell yourself you tested mobile. A mobile viewport is not a mobile device. It is desktop Chrome wearing a costume. This guide shows how to point Playwright at the actual Chrome running on a real cloud Android phone, over the network, and run the exact checks you already wrote.

For context, I run a cloud Android farm in Singapore. These are real phones on a rack, each on its own persistent Singapore mobile ip, each with an adb endpoint you reach over the network, and there is an api to list the fleet and lock a phone while you use it.

Why a mobile viewport is not a mobile device

When you hand Playwright a mobile device descriptor, you get a narrow window, a phone user agent string, and synthetic touch events. Underneath it is still desktop Chrome, on a desktop gpu, rendering with desktop drivers, reaching the site from your server ip, usually a datacenter range.

A real phone differs at every layer. Touch comes from a real touchscreen. The gpu is a mobile gpu, so the graphics fingerprint matches a phone. The ip is a real Singapore mobile ip from a real carrier. When anything reads those signals together, the costume cracks, because the user agent says phone while the gpu string and the ip say desktop in a server room.

Layer Mobile viewport Real cloud phone
Rendering Desktop Chrome + desktop gpu Real mobile Chrome + mobile gpu
Touch Synthetic dispatch Real touchscreen events
Network Datacenter ip Real Singapore mobile ip
Layout Desktop page in a narrow box The real mobile layout the site serves
Locale Generic lab default Real Singapore device locale

The goal is not to fake a phone better. It is to stop faking and drive a real one, without throwing away the Playwright code you already have.

The honest part first

This is not ban proof. Nothing here makes you undetectable, and anyone who says otherwise is selling something. The legitimate uses are the obvious ones: testing your own app or web property, agency work for your own clients, checking how your real site behaves on a real mobile network. What the setup buys you is a mobile browser an anti fraud system has a hard time calling fake, because it genuinely is not fake.

How Playwright attaches to a browser it did not launch

Playwright normally launches its own browser, but it can also attach to one that is already running, as long as that browser exposes the Chrome devtools protocol, shortened to cdp. The method is connectOverCDP. Instead of launching anything, you give it a url that points at an already running Chrome.

On a cloud phone the Chrome we want is running on the phone, not on your machine. So we need two pieces: tell the phone Chrome to expose its debugging socket, and bring that socket across the network.

Connecting adb and forwarding the debug socket

First connect adb to the phone. Take the endpoint from your dashboard and run adb connect adb-sg.cloudf.one:5555, then adb devices to confirm it shows as device. If it says offline, wait two seconds and connect again. Network adb sometimes needs a second attempt on first contact.

Chrome on Android exposes its remote debugging interface through a local socket on the device, not over the open internet. You bridge it with adb forward, mapping a local port on your machine to the device socket localabstract:chrome_devtools_remote. After that one command, a port on your laptop points straight at the Chrome instance on the handset. No cables. adb carries the protocol over the network.

Attaching Playwright and picking the right page

With the port forwarded, the Playwright side is short. Call chromium.connectOverCDP and pass the local debugging url. Playwright attaches and hands you a browser object. From there it feels like normal Playwright, with one difference: you did not create this browser, so you do not own its contexts the usual way. You read the contexts that are already there.

This is where people trip. When you attach to a phone Chrome there may already be tabs open, plus background targets you do not care about. Read browser.contexts, take the first one, look at its pages, and usually take the foreground tab. If there is no page yet, create one. Then assert you are on the page you think you are on before you run anything, because a stale target is the most common reason a script silently does nothing. Log the page url and title the moment you attach. It costs one line and saves an hour.

Run your existing checks, and respect taps

Once you have that page object, your existing checks just run. Same locators, same waits, same assertions. The difference is invisible to your test code and total underneath: every byte goes out over a real Singapore mobile ip, the page renders on a real mobile gpu, and the layout is the real mobile layout the site serves to real phones.

One real difference to respect: on desktop you click, but on a real touchscreen a tap is its own event, and some mobile sites behave differently for a tap than for a synthetic mouse click. Playwright has a tap method that fires the touch path instead of the mouse path. If your flow depends on touch, swipes, or a long press, use the tap and touchscreen methods. For plain links a click is fine. Set hasTouch and isMobile on the context so the page knows it is on a touch device.

Fanning out across the fleet

One phone is a demo. The reason to run on a farm is to drive many at once. Call the api to list the phones, filter to the pool you want, and for each phone lock it through the api so nothing else grabs it mid run. Then for each one connect adb, forward a different local port, and connect Playwright over cdp to that port. One phone per port, one port per worker. When the run finishes, unlock the phone so it returns to the pool. That lock and release loop keeps two jobs from fighting over the same handset.

The failures you will actually hit

The most common error is a port already forwarded. A job crashes before cleanup, the forward is still sitting there, and the next run collides on the same local port. Remove the forward before you set it, or pick a fresh port per worker.

The second is a lost page target. You connected, grabbed a page, then the tab navigated away under you, and now everything times out. Reselect the page right before you act.

The third is a slow first navigation. The first page load on a freshly woken phone over the network can be several seconds slower than you expect. Give that first goto a generous timeout and let the phone warm up.

Wiring it into ci

Once it runs on your machine, ci is the same shape with discipline added. Each job locks a phone through the api, forwards a unique port, runs the suite, then always unlocks the phone in a cleanup step even when the tests fail. That cleanup is the part people forget, and the part that keeps your pool from slowly filling with locked phones nobody released. Tag a pool for ci, keep concurrency sane, and treat a lost phone as a retry, not a hard failure. Because the phone is a network endpoint, the runner needs no usb hardware.

Try it on a real phone

If you want phones to point Playwright at, that is exactly what I run: real cloud Android phones in Singapore on dedicated hardware, each with a persistent Singapore mobile ip, an adb endpoint per phone, and an api to list and lock the fleet. Start at cloudf.one and use code YT30 on your first month. Point Playwright at one, run the checks you already wrote, and watch the mobile layout load the way a real phone sees it.

Get new guides and videos first — join the Telegram channel.

40% off until 31 December 2026
Real phones in Singapore, each with its own mobile IP.
Introductory price until 31 December 2026. A dedicated phone straight away, no queue.