playwright-browser-resize
To resize the browser window, change viewport size to test responsive layouts.
When & Why to Use This Skill
The Playwright Browser Resize skill enables automated control over browser viewport dimensions, allowing developers and QA engineers to programmatically adjust window width and height. This tool is essential for validating responsive web design, ensuring that layouts, navigation menus, and UI components adapt seamlessly across mobile, tablet, and desktop resolutions.
Use Cases
- Responsive Design Testing: Automatically switch between various screen breakpoints (e.g., 375px for mobile, 1440px for desktop) to verify CSS media queries and layout integrity.
- Visual Regression Audits: Set specific viewport sizes before capturing screenshots to detect UI inconsistencies or layout shifts during the development lifecycle.
- Cross-Device Simulation: Emulate the exact screen dimensions of popular devices to test touch-target sizes and mobile-specific user interface elements.
- Automated QA Workflows: Integrate window resizing into end-to-end test scripts to ensure web applications remain functional and visually coherent on non-standard screen sizes.
| name | playwright-browser-resize |
|---|---|
| description | "To resize the browser window, change viewport size to test responsive layouts." |
Usage
Use the MCP tool dev-swarm.request to send the payload as a JSON string:
{"server_id":"playwright","tool_name":"browser_resize","arguments":{}}
Tool Description
Resize the browser window
Arguments Schema
The schema below describes the arguments object in the request payload.
{
"type": "object",
"properties": {
"width": {
"type": "number",
"description": "Width of the browser window"
},
"height": {
"type": "number",
"description": "Height of the browser window"
}
},
"required": [
"width",
"height"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
}
Background Tasks
If the tool returns a task id, poll the task status via the MCP request tool:
{"server_id":"playwright","method":"tasks/status","params":{"task_id":"<task_id>"}}