Live DOM Queries
Gasoline is an open-source MCP server with a query_dom tool that lets AI coding assistants query the live DOM using CSS selectors — without you copying HTML or taking screenshots.
The Problem
Section titled “The Problem”When your AI asks “what does the button say?” or “is the modal visible?”, you have to inspect the page manually and describe what you see. Screenshots help but don’t give your AI structured data it can reason about.
With DOM queries, your AI just asks the browser directly.
How It Works
Section titled “How It Works”- Your AI calls
query_domwith a CSS selector - MCP server forwards the query to the extension
- Extension runs the selector against the live page
- Results returned: tag, attributes, text, children
// AI asks: "What's in the error banner?"{ "selector": ".error-banner"}
// Response:{ "elements": [{ "tag": "div", "className": "error-banner visible", "textContent": "Invalid email address", "attributes": { "role": "alert", "aria-live": "polite" } }]}Example Queries
Section titled “Example Queries”query_dom("nav")— navigation structurequery_dom(".error-message")— visible error messagesquery_dom("[data-testid='user-menu']")— test-id elementsquery_dom("form input[type='email']")— form fieldsquery_dom(".spinner")— check if loading is visible
What Gets Returned
Section titled “What Gets Returned”For each matching element:
| Field | Description |
|---|---|
| Tag name | div, button, input, etc. |
| Class list | Current CSS classes |
| Text content | Visible text |
| Attributes | id, role, aria-, data-, type, value |
| Computed state | Visibility, disabled status |
| Children | Child elements (limited depth) |
get_page_info
Section titled “get_page_info”Get high-level page context without a selector:
{ "url": "http://localhost:3000/dashboard", "title": "Dashboard - MyApp", "viewport": { "width": 1440, "height": 900 }}Use Cases
Section titled “Use Cases”Verifying UI State
Section titled “Verifying UI State”“Is the loading spinner showing?”
Your AI queries .spinner and knows instantly — no screenshot needed.
Debugging Form Issues
Section titled “Debugging Form Issues”“Why won’t the form submit?”
Your AI queries the submit button to check if it’s disabled, and the form inputs for validation states.
Checking Rendered Data
Section titled “Checking Rendered Data”“What items are in the list?”
Your AI queries .list-item and sees all rendered items with their content.
Confirming Fixes
Section titled “Confirming Fixes”After applying a fix, your AI queries the relevant element to verify the change took effect without you refreshing and checking manually.
Error Message Inspection
Section titled “Error Message Inspection”“What error is the user seeing?”
Your AI queries [role="alert"] or .error-message and reads the exact text — then correlates with console errors and network failures to diagnose the root cause.