Playwright: page.goto: net::ERR_NAME_NOT_RESOLVED
Last verified
Error: page.goto: net::ERR_NAME_NOT_RESOLVED at https://exmaple.com/
Call log:
- navigating to "https://exmaple.com/", waiting until "load"What it means
Chromium could not turn the hostname into an IP address, so the navigation failed before any HTTP request was sent. Playwright passes the browser's network error code through unchanged and appends at plus the URL. Firefox reports the same condition as NS_ERROR_UNKNOWN_HOST, and WebKit uses its own wording, so the string depends on which browser you launched.
Because DNS failed, there is no response object, no status code and nothing to retry at the page level. The error is thrown immediately from page.goto rather than after a timeout.
What is not wrong: the site is not necessarily down, and nothing in your locators or waits is involved. The problem is the name itself or the resolver the browser is using, which inside containers and CI is often not the same resolver your laptop uses.
What it looks like
// playwright.config.ts
export default defineConfig({
use: { baseURL: process.env.BASE_URL ?? 'http://localhost:3000' },
});
// Python: surface the real URL when it fails
try:
page.goto(url)
except Exception as e:
raise RuntimeError(f"Navigation to {url!r} failed: {e}")Why it happens
- A typo in the hostname, or a missing scheme so the URL is parsed differently than intended.
- A baseURL or environment variable is empty or wrong in CI, producing a hostname like undefined or a staging domain that does not exist.
- The host is internal (VPN, corporate DNS, docker-compose service name) and the browser runs where that name cannot be resolved.
- The container or runner has no working DNS, or a proxy is required and not configured.
- The domain expired or its DNS records were removed.
How to fix it
- Copy the exact URL from the error and resolve it from the same machine: nslookup host or curl -I https://host.
- Log the final URL your code builds, including baseURL from playwright.config, to catch empty variables.
- For docker-compose, run the browser container on the same network and use the service name; for host services use host.docker.internal where supported.
- If a proxy is required, pass proxy: { server: 'http://proxy:3128' } in launch or context options.
- Fail fast with a clear message: wrap goto in a check that the hostname resolves before starting a long job.
How to stop it recurring
Validate configuration at startup: assert that base URLs are set and parse correctly before launching a browser. Run browser jobs on the same network as the services they test. Keep a cheap DNS or HTTP preflight in CI so infrastructure problems fail in seconds with a readable message instead of surfacing deep inside a test.
Official documentation: playwright.dev/docs/api/class-page#page-goto. See all Playwright error messages.
Related errors
Definitions
- PlaywrightPlaywright is Microsoft's open-source browser automation framework that provides a single API to control Chrom
- Chrome DevTools Protocol (CDP)The Chrome DevTools Protocol (CDP) is the JSON-over-WebSocket interface Chrome exposes for inspecting and cont
- CSS SelectorA CSS selector is a pattern used to identify and target specific HTML elements on a web page, widely used in b
- Headless ChromeHeadless Chrome is Google Chrome running without a visible window. It renders pages and runs JavaScript like n
- IframeAn iframe (inline frame) is an HTML element that embeds a separate web page within a parent page, creating an
- Web ElementA web element is any individual component rendered on a web page — buttons, links, input fields, images, text
Quick answers
What does "page.goto: net::ERR_NAME_NOT_RESOLVED" mean in Playwright?
Chromium could not turn the hostname into an IP address, so the navigation failed before any HTTP request was sent. Playwright passes the browser's network error code through unchanged and appends at plus the URL. Firefox reports the same condition as NS_ERROR_UNKNOWN_HOST , and WebKit uses its own wording, so the string depends on which browser you launched.
How do I fix "page.goto: net::ERR_NAME_NOT_RESOLVED"?
1. Copy the exact URL from the error and resolve it from the same machine: nslookup host or curl -I https://host. 2. Log the final URL your code builds, including baseURL from playwright.config, to catch empty variables. 3. For docker-compose, run the browser container on the same network and use the service name; for host services use host.docker.internal where supported. 4. If a proxy is required, pass proxy: { server: 'http://proxy:3128' } in launch or context options. 5. Fail fast with a clear message: wrap goto in a check that the hostname resolves before starting a long job.
Run browser automation you can watch and take over
Autonoly runs each job in a real cloud Chromium browser driven by Playwright. Timeouts and detached elements still happen; the difference is that you can watch the run live, see the step that failed, and take control of the browser to finish it.
Also see Live browser control.