{"record":{"id":"302f784f351f1e9d","repo":"karatelabs/karate","slug":"driver-keyword-requires-a-url-argument","errorCode":null,"errorMessage":"driver keyword requires a URL argument","messagePattern":"driver keyword requires a URL argument","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"karate-core/src/main/java/io/karatelabs/core/StepExecutor.java","lineNumber":3082,"sourceCode":"        // Bare variable / JS expression: return the live object so mutations made\n        // after the configure step are reflected. Any embedded #(...) it carries is\n        // left intact and resolved per-request on a fresh copy.\n        return runtime.eval(wrapJsonLikeExpression(expr));\n    }\n\n    // ========== Browser Driver ==========\n\n    /**\n     * Execute the driver keyword - navigate to a URL.\n     * Examples:\n     * - driver 'http://localhost:8080'\n     * - driver serverUrl + '/path'\n     * - driver myUrl\n     */\n    private void executeDriver(Step step) {\n        String text = step.getText();\n        if (text == null || text.trim().isEmpty()) {\n            throw new RuntimeException(\"driver keyword requires a URL argument\");\n        }\n\n        // Evaluate the expression to get the URL\n        Object result = runtime.eval(text.trim());\n        if (result == null) {\n            throw new RuntimeException(\"driver URL evaluated to null: \" + text);\n        }\n\n        String url = result.toString();\n\n        // Get the driver (initializes lazily if needed)\n        io.karatelabs.driver.Driver driver = runtime.getDriver();\n\n        // Navigate to the URL\n        driver.setUrl(url);\n    }\n\n    // ========== Karate Expression Helpers ==========","sourceCodeStart":3064,"sourceCodeEnd":3100,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/core/StepExecutor.java#L3064-L3100","documentation":"The standalone `driver` keyword sets the browser driver's URL and requires the step text to be a non-empty expression evaluating to the server URL. When the text is null or blank there is nothing to evaluate or navigate to, so the executor throws immediately before evaluation.","triggerScenarios":"A `driver` step with no text (e.g. `* driver` alone); text consisting only of whitespace; a step parsed such that the URL ended up in a docstring or argument instead of the text.","commonSituations":"Deleting the URL during refactoring; template placeholders like `driver <url>` left unfilled; formatting errors where the URL landed on a following line treated as a separate step.","solutions":["Provide a URL: `driver 'http://localhost:9222'` or `driver myUrlVariable`","If configuring instead of navigating, use `configure driver = {...}`","Ensure the URL expression is on the same step text, not a docstring","print the URL variable to confirm it is populated"],"exampleFix":"// before\n* driver\n// after\n* driver 'http://localhost:9222'","handlingStrategy":"validation","validationCode":"* if (!driverUrl) karate.fail('driver step needs a URL')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never write a bare 'driver' step","Keep driver URLs in config/environment files","Review UI test templates for unfilled placeholders"],"tags":["driver","ui","missing-required-argument"],"backgroundTag":"missing-required-argument","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"}