Block unnecessary resources
Block heavy assets like images, stylesheets, and fonts that aren’t needed for your automation. This reduces page load time significantly.Example
Example
TypeScript
Use network interception instead of DOM scraping
Intercept API responses directly instead of parsing the DOM. This is often 10x faster and more reliable. Use browser dev tools to find which API endpoints return the data you need. The following examples show the same scraper—first using DOM manipulation, then using network interception.DOM Manipulation (Slower)
DOM Manipulation (Slower)
TypeScript
Network Interception (Faster)
Network Interception (Faster)
TypeScript
Set shorter timeouts
The default Playwright timeout is 30 seconds. If your pages load quickly, reduce it to fail faster on errors.Example
Example
TypeScript
Optimize waiting strategies
Avoid waitForTimeout
Avoid waitForTimeout() with arbitrary delays—they waste time when pages load fast and fail when pages load slowly. Instead, wait for something specific.
Wait for DOM or network to settle
After actions that trigger page changes, use Intuned helpers:- waitForDomSettled — After clicking buttons that modify the page
- withNetworkSettledWait — After navigation or actions that trigger API calls
Extract lists efficiently
When scraping lists, avoid iterating with locators—each locator call auto-waits, adding milliseconds per row that compounds over hundreds of elements. Instead:- Wait for the list container to be visible
- Extract all data in a single
evaluate()call usingquerySelectorAll
Example: Scraping a list
Example: Scraping a list
TypeScript
Batch evaluate calls
Eachevaluate() call is a round trip to the browser. Combine multiple queries into a single call.
Example
Example
TypeScript
Defer heavy processing
Move expensive operations outside the browser context. Extract raw data first, then process it after the automation completes. This includes image processing, LLM calls, data transformation, and file conversions.Example
Example
TypeScript
Use AuthSessions
Instead of logging in every run, use AuthSessions to reuse authenticated browser state. This can save 5-30 seconds per run depending on the login complexity.Replace AI code with deterministic code
AI agents require multiple LLM calls per action. If your automation does predictable, repeatable steps, replace AI code with direct selectors. Use AI only for unpredictable page structures or as a fallback when deterministic code fails.Stagehand Agent (Slower)
Stagehand Agent (Slower)
TypeScript
Deterministic Code (Faster)
Deterministic Code (Faster)
TypeScript
Use fetch for static content
For static content, fetch HTML directly instead of using the browser. Only use the browser when JavaScript rendering is required.Example
Example
TypeScript
Adjust browser configuration
If optimizations don’t help and simple actions are still slow, the site may be JavaScript-heavy. Consider these configuration changes:- Use a larger machine — Upgrade your machine size in replication settings for resource-intensive sites.
- Turn off unnecessary features — Headful mode, stealth mode, and proxies add overhead. Disable them in
intuned.jsonif your automation works without them.
Additional tips
- Build URLs directly — Instead of clicking through filters, build the final URL with query parameters (e.g.,
?category=electronics&price=under-100). - Go to iframe URLs directly — Instead of using
frameLocator, navigate directly to the iframe’s source URL to avoid loading the parent page. - Use
fill()instead ofpressSequentially()—pressSequentially()types character-by-character. Usefill()for instant input unless you need keystroke events. - Avoid returning large data from
evaluate()— Extract only the fields you need, not entire DOM elements or large HTML strings.