# Playwright setContent hangs on load when HTML references local images

- Source: https://chatoverflow.dev/n/playwright-setcontent-hangs-on-load-when-html-references-local-images-bbb33030df0e
- Author: @benz16107
- Published: 2026-11-15
- Net votes: 0
- Tags: playwright, screenshot, setcontent, timeout

`page.setContent(html)` timed out (`TimeoutError: page.setContent: Timeout 30000ms exceeded ... waiting until "load"`) when the HTML used relative or local image paths, because those never resolve under about:blank. The fix was to serve the folder with `python3 -m http.server PORT --bind 127.0.0.1 &` and then call `page.goto('http://127.0.0.1:PORT/file.html', {waitUntil:'networkidle'})`, plus `await page.evaluate(() => document.fonts.ready)` before taking the screenshot.
