getLatestLogs()
Retrieve captured browser console logs (up to 5000 per page, cleared on navigation).page— Filter to specific page. If not provided, returns logs from all pagescount— Limit to last N logssearch— Filter logs matching string or regex pattern (returns matches with 5 lines context)
waitForPageLoad()
Smart load detection that ignores analytics/ads and waits for page to be interactive.page— Page to wait fortimeout— Max wait time in ms (default: 5000)pollInterval— How often to check in ms (default: 100)minWait— Minimum wait time in ms (default: 0)
getCDPSession()
Get Chrome DevTools Protocol session for sending raw CDP commands.getCDPSession({ page }), never page.context().newCDPSession() — the latter doesn’t work through the playwriter relay.
Examples:
refToLocator()
Convert a ref from a snapshot or screenshot to a Playwright locator string.ref— The ref string (e.g.,"e3","submit-btn")page— Optional page (defaults to current page)
getCleanHTML()
Get cleaned HTML from a locator or page, with search and diffing support.locator— Playwright Locator or Page to get HTML fromsearch— Filter results to first 10 matching lines with 5 lines contextshowDiffSinceLastCall— Return diff since last call (default:true, butfalsewhensearchis provided)includeStyles— Keep style and class attributes (default:false)
- Removes tags: script, style, link, meta, noscript, svg, head
- Unwraps nested wrappers: Empty divs/spans with no attributes that only wrap a single child are collapsed
- Removes empty elements: Elements with no attributes and no content are removed
- Truncates long values: Attribute values >200 chars and text content >500 chars are truncated
- Keeps semantic attributes: href, name, type, aria-*, data-*, testid, qa, e2e, vimium-label, etc.
getPageMarkdown()
Extract main page content as plain text using Mozilla Readability (same algorithm as Firefox Reader View). Strips navigation, ads, sidebars, and other clutter.page— Page to extract content fromsearch— Filter content to first 10 matching lines with 5 lines contextshowDiffSinceLastCall— Return diff since last call (default:true, butfalsewhensearchis provided)
- Extract article text for LLM processing without HTML noise
- Get readable content from news sites, blogs, documentation
- Compare content changes after interactions
getLocatorStringForElement()
Get stable Playwright selector from an element.createDebugger()
Set breakpoints, step through code, inspect variables at runtime. Useful for debugging issues that only reproduce in browser. Always fetchhttps://playwriter.dev/resources/debugger-api.md first with curl or webfetch tool for full API documentation.
createEditor()
View and live-edit page scripts and CSS at runtime. Edits are in-memory (persist until reload). Always readhttps://playwriter.dev/resources/editor-api.md first with curl or webfetch tool for full API documentation.
getStylesForLocator()
Inspect CSS styles applied to an element, like browser DevTools “Styles” panel. Always fetchhttps://playwriter.dev/resources/styles-api.md first with curl or webfetch tool for full API documentation.
getReactSource()
Get React component source location (dev mode only).resizeImage()
Shrink an image in-place so it consumes fewer tokens when read back into context.input— File path or BuffermaxDimension— Max pixels on longest edge (default: 1568, Claude-optimal)width— Explicit target width in px (aspect ratio preserved unless both width+height set)height— Explicit target height in pxfit— How to fit when both width+height specified (default: ‘inside’)quality— JPEG quality 1-100 (default: 80)output— Output file path (defaults to overwriting input file)