karatelabs/karate · error · DriverException
inputFile not supported by this driver
Error message
inputFile not supported by this driver
What it means
Driver.inputFile(String, String...) is a default method that drivers must override to support file uploads. The default implementation throws this DriverException, meaning the active driver (e.g. a minimal or custom Driver implementation) does not implement file upload. Note the resolved path must exist on the machine the browser runs on, not the machine running Karate.
Solutions
- Upgrade or fix the driver implementation so it overrides inputFile (re-check the adapter version matches your Karate version)
- If using a remote browser, ensure the file path exists on the browser machine and pass it verbatim with the file: prefix
- As a workaround, set the input value directly (driver.value(locator, path)) where the driver/browser supports it
Example fix
// before
customDriver.inputFile("#upload", "/tmp/report.pdf"); // throws
// after
// use a driver that overrides inputFile, e.g. Chrome/Edge/Gecko driver
driver.inputFile("#upload", "file:///tmp/report.pdf"); Defensive patterns
Strategy: try-catch
Validate before calling
// detect support before calling:
// if (!(driver instanceof Chrome || driver instanceof Edge)) { /* use alternative */ } Try / catch
try { driver.inputFile(loc, path); } catch (DriverException e) { if (e.getMessage().equals("inputFile not supported by this driver")) { /* fallback: value() or switch driver */ } else throw e; } Prevention
- Use a mainstream driver (Chrome/Edge/Gecko) that implements inputFile
- For remote grids, ensure files exist on the browser host and pass file: URLs
- Keep driver adapters at the same version as karate-core
When it happens
Trigger: Calling driver.inputFile("input[type=file]", "data/file.pdf") against a Driver implementation that did not override inputFile (custom driver, stub driver, or a driver type without upload support).
Common situations: Custom/third-party Driver implementations missing the override; drivers for environments where file transfer to the browser is impossible; outdated driver adapters lagging behind the current Karate API.
Related errors
- driver keyword requires a URL argument
- driver URL evaluated to null:
- element not found:
- missing array argument 'patterns':
- missing 'mock' or 'handler' in intercept config
AI-assisted analysis of karatelabs/karate@a22eb90246 (2026-09-12).
Data as JSON: /api/errors/c96abe16da322bc3.
Report an issue: GitHub.
Appendix: source
Thrown at karate-core/src/main/java/io/karatelabs/driver/Driver.java:939
/**
* Set the files of a file {@code <input>} element — the ONLY way to drive a file upload:
* browsers forbid setting a file input's {@code value} from script (a page must never be
* able to pick a file off the user's disk), so {@code value()} throws and {@code input()}
* keystrokes go nowhere. Each backend uses its native mechanism instead (CDP
* {@code DOM.setFileInputFiles}, W3C element send-keys).
*
* <p>File references resolve exactly like {@code read()} — relative to the calling feature,
* with {@code classpath:}, a root-anchored leading {@code /}, and {@code file:} for a real
* OS path (see {@link DriverApi#resolveFilePaths}). Multiple files need an input with the
* {@code multiple} attribute. The element does not need to be visible — file inputs are
* routinely hidden behind styled buttons.</p>
*
* <p>NOTE: the resolved path is handed to the browser process — with a remote browser
* (grid, container) the file must exist on the machine the BROWSER runs on; use
* {@code file:} to name such a path verbatim.</p>
*/
default Element inputFile(String locator, String... files) {
throw new DriverException("inputFile not supported by this driver");
}
/**
* Set the value of an input element directly.
*/
default Element value(String locator, String value) {
script(Locators.inputJs(locator, value));
return BaseElement.of(this, locator);
}
/**
* Select an option from a dropdown by text or value.
*/
default Element select(String locator, String text) {
Object matched = script(Locators.optionSelector(locator, text));
if (!Boolean.TRUE.equals(matched)) {
throw new DriverException("select failed, no option matching: '" + text + "' for: " + locator);
}View on GitHub (pinned to a22eb90246)