DEV Community

Cover image for Drag-and-Drop Automation is Finally Native in Playwright MCP
Anton Gulin
Anton Gulin

Posted on Originally published at anton.qa

Drag-and-Drop Automation is Finally Native in Playwright MCP

Originally published on anton.qa.

I hate testing drag-and-drop.

Most QA teams do. We either skip it or we write hacks.

I have seen it all. Scripts that try to "flick" the mouse. Scripts that inject JavaScript.

They all break. They are hard to maintain.

This month, Playwright MCP v0.0.71 shipped a fix.

It adds a tool called browser_drop.

Why This Changes Things

Before, your AI agent had to guess how to move an item.

Now, it uses the native Playwright API: Locator.drop.

It works for:

  • Moving cards in a grid.
  • Dropping files into an upload zone.
  • Reordering lists. It works because it handles the mouse events for you.

No more "faking" the move.

How to Use It

Here is one line of code to use in your MCP tool:

const result = await server.tools.call("browser_drop", {
  source: "text=MyFile.pdf",
  target: "#drop-zone",
});
Enter fullscreen mode Exit fullscreen mode

That is it. One command.

The AI agent finds the file. It moves it to the zone. It drops it.

The "Below the Fold" Gotcha

There is one small catch.

Playwright needs the items to be on your screen to drop them.

If your list is long and the target is at the bottom, the drop will fail.

The Fix: Scroll the target into view first.

// Scroll first, then drop
await server.tools.call("browser_evaluate", {
  expression: `document.querySelector("#drop-zone").scrollIntoView()`,
});
Enter fullscreen mode Exit fullscreen mode

This simple step stops your tests from failing in CI (where screens are smaller).

What Else Is New?

The v0.0.71 release added two more features:

  1. Network Bodies: browser_network_requests now captures the full response from your server. You can check what the API said, not just the status code.
  2. Plain Code: browser_evaluate now takes plain JavaScript. You do not need a function wrapper anymore.

Verdict

If you use AI agents for testing, upgrade today.

browser_drop removes the last big "hack" in our pipeline.

I architect the systems AI agents run on. Native tools like this make those systems stable.

I'm Anton. I build AI tools and measure how fast they really run. Former Apple engineer. I make ollamatps.com and write about building and measuring AI at anton.qa.

Top comments (0)