{"record":{"id":"e625c10a105e8e69","repo":"karatelabs/karate","slug":"timeout-waiting-for-oopif-readiness-frameid-expectedurl-will","errorCode":null,"errorMessage":"timeout waiting for OOPIF readiness: frameId={}, expectedUrl={} (will retry on first use)","messagePattern":"timeout waiting for OOPIF readiness: frameId=(.+?), expectedUrl=(.+?) \\(will retry on first use\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"karate-core/src/main/java/io/karatelabs/driver/cdp/CdpDriver.java","lineNumber":2609,"sourceCode":"                            logger.trace(\"OOPIF ready: frameId={}, readyState={}, url={}\", frameId, r, u);\n                            return true;\n                        }\n                    }\n                } else {\n                    Object value = response.getResult(\"result.value\");\n                    if (value instanceof String && !\"loading\".equals(value)) {\n                        logger.trace(\"OOPIF ready: frameId={}, readyState={}\", frameId, value);\n                        return true;\n                    }\n                }\n            } catch (Exception e) {\n                logger.trace(\"OOPIF readiness check failed (will retry): {}\", e.getMessage());\n            }\n            return false;\n        });\n        if (!ready) {\n            // Not fatal — element-level retry in retryIfNeeded() will absorb any remainder.\n            logger.warn(\"timeout waiting for OOPIF readiness: frameId={}, expectedUrl={} (will retry on first use)\",\n                    frameId, expectedUrl);\n        }\n    }\n\n    /**\n     * Verify a (non-main) frame's execution context is actually ready for JS\n     * execution. Context-id ARRIVAL is event-driven (see awaitFrameContext); this\n     * probe is deliberately still a poll — \"the id exists\" does not mean \"the\n     * frame's document is ready to run script\" (it may still be loading), and no\n     * CDP event announces that transition for a contextId-addressed world.\n     */\n    private void waitForFrameContextReady(String frameId) {\n        boolean ready = pollUntil(1000, 50, () -> {\n            Integer contextId = frameContexts.get(frameId);\n            if (contextId == null) {\n                return false;\n            }\n            try {","sourceCodeStart":2591,"sourceCodeEnd":2627,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/driver/cdp/CdpDriver.java#L2591-L2627","documentation":"For cross-origin (OOPIF) frames, CdpDriver polls document.readyState (and document.URL vs the expected URL) on the OOPIF's own CDP session for up to 2s. If the frame's document never leaves 'loading' or the URL never commits, this warning is logged. It is intentionally non-fatal: the element-level retry logic (retryIfNeeded) will retry on first use.","triggerScenarios":"switchFrame() into a cross-origin iframe whose document takes longer than 2s to parse, or whose document.URL never matches the URL captured at match time — slow networks, heavy OOPIF pages, or cross-process navigation delays.","commonSituations":"Testing embedded third-party iframes (payment, captcha, video) on slow CI networks, OOPIF iframes redirecting again immediately after load, or resource-starved CI containers where parsing is slow.","solutions":["Increase the driver's retry interval / timeouts so the first-use retry absorbs the remainder of the load.","Wait for the iframe's content (e.g. waitFor on an element inside the frame or waitForUrl) before interacting.","Ensure the iframe URL is final — avoid switching frames while the iframe is still redirecting.","Free CI resources / reduce load; OOPIF readiness polling is latency-sensitive."],"exampleFix":"// before\ndriver.switchFrame(\"iframe.cross-origin\");\ndriver.click(\"#button-in-frame\"); // races parser\n// after\ndriver.switchFrame(\"iframe.cross-origin\");\ndriver.waitFor(\"#button-in-frame\");\ndriver.click(\"#button-in-frame\");","handlingStrategy":"retry","validationCode":"// wait for the iframe to finish its own navigation before switching\ndriver.waitForUrl(\"**/checkout\");\ndriver.waitFor(\"iframe.cross-origin\");","typeGuard":null,"tryCatchPattern":"driver.switchFrame(iframeLocator);\ndriver.waitFor(\"#element-inside-frame\"); // built-in retry absorbs OOPIF readiness remainder","preventionTips":["Wait for an element inside the OOPIF before interacting","Avoid switching frames while the iframe is still redirecting","Give CI enough CPU/memory — OOPIF parsing is latency-sensitive","Increase retryInterval so first-use retries cover slow loads"],"tags":["cdp","oopif","cross-origin-iframe","timeout"],"backgroundTag":"frame-readiness-timeout","analyzedSha":"a22eb90246d958d15a47bf436693d0121ad2812d","analyzedAt":"2026-09-12T09:01:00.220Z","contentChangedAt":"2026-09-12T09:01:00.220Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}