Skip to main content
Web Development5 min read

How I Audited and Fixed My Next.js Mobile UI in Minutes Using Playwright MCP

By Bhavik Rathod

Playwright MCP banner

Every developer knows the tedious dance of mobile UI auditing. You deploy your site, open Chrome DevTools, toggle the device simulator, resize to different breakpoints, check the layout, make a local change, refresh, and repeat.

Recently, I had an experience that completely changed how I approach this workflow. I used Playwright MCP (Model Context Protocol) to audit, debug, and visually verify my Next.js website’s UI on mobile and desktop – all from my editor’s AI chat window.

Here is how it went down and why it is a game-changer for frontend developers.

What is Playwright MCP?

Model Context Protocol (MCP) is an open standard that allows AI agents to securely connect to external tools and data sources. The Playwright MCP server gives an AI assistant (like my coding agent) a headless browser instance.

Instead of just writing code blindly, the AI agent can:

  1. Navigate to any live URL or local dev server.

  2. Resize the viewport to precise dimensions (e.g., simulating an iPhone or a 4K desktop screen).

  3. Take full-page screenshots and visually inspect layouts.

  4. Capture accessibility trees (browser_snapshot) and check console errors.

Step 1: The Live Site Audit

I started by asking my AI agent to open my live site: launchingstartup.com.

Under the hood, the agent called the Playwright MCP tool:

await page.goto('https://launchingstartup.com/');await page.setViewportSize({ width: 1280, height: 800 }); // Desktop view
await page.screenshot({ fullPage: true, path: './desktop_view.png' });

It then resized the viewport to 375x812 to simulate a standard iPhone screen, took a mobile screenshot, and analyzed them.

What the AI spotted:

  • Desktop Layout: Looked clean and visually consistent.

  • Mobile Crowding: The header’s “Book a call” button was taking up too much horizontal space next to the hamburger menu on small viewports.

  • Missing Hamburger Menu: While the home page had a mobile menu drawer, sub-pages (like my /work portfolio page and case study detail pages) were using a simplified navigation bar that hid links on mobile without rendering a hamburger toggle. Mobile users were essentially trapped on those pages!

  • Overlay Blocking: The Tawk.to chat widget’s pre-expanded greeting bubble was overlapping critical call-to-action buttons.

QuriousClick-How_I_Audited_and_Fixed_My_NextJS_Mobile_UI_In_Minutes_Using_Playwright_MCP_Before_1.webp

QuriousClick-How_I_Audited_and_Fixed_My_NextJS_Mobile_UI_In_Minutes_Using_Playwright_MCP_Before_2.webp

Step 2: Coding the Fixes Locally

With the issues identified, I didn’t need to manually hunt for files. The AI agent immediately located the relevant React components in my Next.js codebase.

  1. Collapsible Calendar Icon: In both my main header and sub-page header, we updated the button to collapse dynamically. Instead of displaying the text “Book a call” on mobile, it turns into a compact, circular icon button (w-11 h-11 bg-ink) containing a calendar SVG. On desktop, it automatically expands back to the full button with text.

  2. Stateful Mobile Menu on Sub-Pages: We refactored CaseStudyNav.tsx to add useState toggle logic, scroll shadows, backdrop blur overlays, and the hamburger toggle. We mapped the mobile drawer links to absolute paths (e.g. /#how, /#services) so users could navigate back to the home page’s sections from any sub-page.

Step 3: Local Dev Verification with Playwright

This is where the magic happened. Rather than having me run npm run dev and test it myself, the AI agent took charge:

  1. It ran my Next.js local server in the background: npm run dev (starts on http://localhost:3000).

  2. It used Playwright MCP to navigate to the local server.

  3. It resized the local view to mobile (375x812) and took a screenshot.

  4. It programmatically clicked the #menu-toggle button to open the mobile drawer and took a second screenshot to verify the open state.

Here is the exact code it executed programmatically to click my menu:

await page.locator('#menu-toggle').click();
await page.screenshot({ path: './local_work_mobile_menu.png' });

The screenshots proved the layout was flawless. The collapsed calendar button looked extremely slick next to the hamburger icon, and the mobile menu drawer animated open perfectly with all absolute links intact.

QuriousClick-How_I_Audited_and_Fixed_My_NextJS_Mobile_UI_In_Minutes_Using_Playwright_MCP_After_1.webp

QuriousClick-How_I_Audited_and_Fixed_My_NextJS_Mobile_UI_In_Minutes_Using_Playwright_MCP_After_2.webp

Why Agentic Browser Testing is the Future

This workflow is a massive shift in developer productivity:

  • Closed Feedback Loop: The AI agent doesn’t just write code; it runs it, views it, and verifies it. It acts as both the developer and the QA tester.

  • Visual Context: Because the AI can “see” screenshots, it catches spacing anomalies, overlapping widgets, and responsive layout breakage that regular unit tests would miss.

  • Zero Context Switching: I never had to leave my editor, spin up browsers, click around, or inspect HTML selectors.

Playwright MCP turns browser automation into an extension of the AI’s mind, letting us build and verify visually consistent web applications in a fraction of the time.

🚀 Need a Team that Ships Fast?

If you’re a founder looking to build a high-performance web app, iOS/Android mobile app, or a high-converting landing page, we design, build, and launch startups.

No endless cycles. Just real results, shipped fast.

Get in touch with our founders and let’s bring your idea to life!

Blogs

Field notes on shipping software, design, and everything in between.

AI SDK Laravel - library (1)
Web DevelopmentJul 3, 2026

Laravel AI SDK : A Complete Overview of Building AI Features in PHP

Laravel AI is Laravel’s official, first-party package for building AI features into PHP applications. Instead of pulling in…

Playwright MCP
Web DevelopmentJun 2, 2026

How I Audited and Fixed My Next.js Mobile UI in Minutes Using Playwright MCP

Every developer knows the tedious dance of mobile UI auditing. You deploy your site, open Chrome DevTools, toggle…

agile team management thumbnail
StoriesJul 19, 2023

Agile Team Management Unleashed: Insights from Top 5 Management Books for Small IT Agencies

Welcome to our blog, where we embark on a journey to unlock the secrets of maintaining a small…

Ways to create Effective UI/UX Design Portfolio
UI/UXDec 15, 2022

Ways to create Effective UI/UX Design Portfolio

In an industry where education and experience are not necessarily requirements for a dream position, a UX design…

5 Prototyping Tools for UI/UX Designers
UI/UXSep 12, 2022

5 Prototyping Tools for UI/UX Designers

It may sound cliche, but it’s also true that prototyping plays an important role in communicating how the…

Dark UI Design : Best Practices
UI/UXAug 25, 2022

Dark UI Design : Best Practices

Dark theme was introduced with IOS 13 in September 2019 followed by Android 10(Q) in May 2020 after…

What is viewBinding in Android and How we can use it?
Android App DevelopmentAug 24, 2022

What is viewBinding in Android and How we can use it?

Till now when we want to connect an XML element to a java or kotlin file we always…

5 Figma Plugins that can be used to create Good User Interface
UI/UXAug 24, 2022

5 Figma Plugins that can be used to create Good User Interface

After the launch in 2016, Figma has grown to become one of the leading UI design tools on…

MySQL Tips & Tricks : Functions
Web DevelopmentAug 24, 2022

MySQL Tips & Tricks : Functions

In our previous article on MySQL, we covered Triggers. In this article we are covering another important feature…

Free consultation to scope your
creative projects

Book demo

FAQ

Ask AI to summarize QuriousClick
Have a project in mind?Tell us what you're planning and we'll help you shape the scope, timeline and next steps.
Book a discovery call
  • QuriousClick is a design and development studio. Since 2014 our in-house team has designed, built and supported websites, web and mobile apps, brands and AI products for 100+ customers worldwide.