{"record":{"id":"7d18e82bc5465860","repo":"karatelabs/karate","slug":"page-navigate-timed-out-retrying","errorCode":null,"errorMessage":"Page.navigate timed out, retrying ({}/{}): {}","messagePattern":"Page\\.navigate timed out, retrying \\((.+?)/(.+?)\\): (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"karate-core/src/main/java/io/karatelabs/driver/cdp/CdpDriver.java","lineNumber":1303,"sourceCode":"        //      (element-not-found, waitUntil timeouts, value mismatches). A deliberate\n        //      abort re-aborts on every attempt, so after the bounded retries we accept\n        //      the retention (history.feature's 204 test still passes); a spurious\n        //      abort commits on a retry and the scenario gets the document it asked for.\n        // (A beforeunload prompt is auto-accepted in the dialog handler above, so the\n        // timeout retry is for genuine transient timeouts, not the leave-page case.)\n        int navAttempts = 3;\n        CdpResponse navResponse = null;\n        boolean aborted = false;\n        for (int attempt = 0; attempt < navAttempts; attempt++) {\n            try {\n                navResponse = cdp.method(\"Page.navigate\")\n                        .param(\"url\", url)\n                        .send();\n            } catch (RuntimeException e) {\n                boolean transientNavTimeout = e.getMessage() != null\n                        && e.getMessage().contains(\"CDP timeout for: Page.navigate\");\n                if (transientNavTimeout && attempt < navAttempts - 1) {\n                    logger.warn(\"Page.navigate timed out, retrying ({}/{}): {}\", attempt + 1, navAttempts - 1, url);\n                    continue;\n                }\n                throw e;\n            }\n            aborted = \"net::ERR_ABORTED\".equals(navResponse.getResultAsString(\"errorText\"));\n            if (!aborted) {\n                break; // committed, an error page under the same loader, or a normal response\n            }\n            if (attempt < navAttempts - 1) {\n                logger.warn(\"Page.navigate returned ERR_ABORTED, retrying ({}/{}): {}\", attempt + 1, navAttempts - 1, url);\n                sleep(150); // let an in-flight/racing navigation (e.g. pooled-reset about:blank) settle\n            }\n        }\n\n        // Every attempt aborted — a deliberate download / 204-205 / window.stop() that\n        // retains the current document. The returned loader never commits, never fires\n        // DOMContentLoaded, and a loader-bound wait for it could only end in a timeout,\n        // so return with the page as-is (genuine load failures instead commit an error","sourceCodeStart":1285,"sourceCodeEnd":1321,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/driver/cdp/CdpDriver.java#L1285-L1321","documentation":"Karate's CDP driver retries Page.navigate when the browser fails to answer within the CDP timeout, logging this warning between attempts. The message reports attempt progress ({}/{}), the retry budget, and the target URL. It is a warning, not a thrown error; a RuntimeException is only rethrown after the final attempt also times out.","triggerScenarios":"driver.loadUrl / driver.get(url) where the CDP Page.navigate command exceeds the CDP timeout, e.getMessage() contains 'CDP timeout for: Page.navigate', and attempt < navAttempts - 1 so a retry is still available.","commonSituations":"Slow or overloaded CI machines, remote/headless Chrome under load, very large pages or slow redirects, network latency to an external URL, or a CDP websocket momentarily stalled during navigation.","solutions":["Increase the CDP timeout (e.g. karate.configure('webdriverTimeout'/'timeout') or the driver timeout config) so navigation has more headroom.","Retry the driver.get()/loadUrl call; transient attempts often succeed on the second try.","Verify the target URL is reachable from the test host (curl it) and check DNS/proxy settings.","Reduce load on the browser/CI runner (fewer parallel Chrome instances) and ensure adequate CPU/memory."],"exampleFix":"// before\nkarate.configure('timeout', 10000);\n// after\nkarate.configure('timeout', 30000); // more headroom for slow Page.navigate on loaded CI","handlingStrategy":"retry","validationCode":"// check reachability before navigating\nboolean ok = java.net.InetAddress.getByName(\"example.com\").isReachable(3000);","typeGuard":null,"tryCatchPattern":"try { driver.get(url); } catch (RuntimeException e) { if (e.getMessage().contains(\"CDP timeout for: Page.navigate\")) { driver.get(url); } else { throw e; } }","preventionTips":["Configure a generous page/CDP timeout for CI","Check URL reachability before navigation","Limit parallel Chrome instances on shared runners","Retry flaky navigations at the test level"],"tags":["cdp","navigation","timeout","retry"],"backgroundTag":"request-timeout","analyzedSha":"a22eb90246d958d15a47bf436693d0121ad2812d","analyzedAt":"2026-09-12T09:01:00.220Z","contentChangedAt":"2026-09-12T09:01:00.220Z","schemaVersion":2},"datasetVersion":"2026-09-16T19:17:19.609Z"}