#3015·karate

Browser file upload blocked

Author: alreayCreated Aug 21, 2026Updated Aug 26, 2026
Labelsbugfixed

Description

Uploading a file via the browser no longer works in v2.

driver.inputFile() worked in v1. Now in v2 that function has been removed and the documentation says to use value() or input() instead. Neither of these new ways work. Using value() gives an error, input() writes the filename to the previous input element in the dom and quietly continues without doing anything useful.

Steps to Reproduce

Create a simple input element for file uploads then use value() to set it

gherkin
Feature: Simple
	Scenario: File upload test
		* configure driver = { type: 'chrome' }
		* driver "about:blank"
		* script('document.body.innerHTML = "<input id=\\"upload_file\\" type=\\"file\\">"')
		* value('#upload_file', 'test.jpg')

Expected Behavior

Input element set with file

Actual Behavior

Code: value('#upload_file', 'test.jpg')
Error: JS exception: InvalidStateError: Failed to set the 'value' property on 'HTMLInputElement': This input element accepts a filename, which may only be programmatically set to the empty string.

Karate Version

2.1.2

Java Version

25.0.3

Operating System

Linux